1
exercism fetch csharp rail-fence-cipher

RailFenceCipherTest.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// This file was auto-generated based on version 1.0.1 of the canonical data.

using Xunit;

public class RailFenceCipherTest
{
    [Fact]
    public void Encode_with_two_rails()
    {
        var msg = "XOXOXOXOXOXOXOXOXO";
        var sut = new RailFenceCipher(2);
        var expected = "XXXXXXXXXOOOOOOOOO";
        Assert.Equal(expected, sut.Encode(msg));
    }

    [Fact(Skip = "Remove to run test")]
    public void Encode_with_three_rails()
    {
        var msg = "WEAREDISCOVEREDFLEEATONCE";
        var sut = new RailFenceCipher(3);
        var expected = "WECRLTEERDSOEEFEAOCAIVDEN";
        Assert.Equal(expected, sut.Encode(msg));
    }

    [Fact(Skip = "Remove to run test")]
    public void Encode_with_ending_in_the_middle()
    {
        var msg = "EXERCISES";
        var sut = new RailFenceCipher(4);
        var expected = "ESXIEECSR";
        Assert.Equal(expected, sut.Encode(msg));
    }

    [Fact(Skip = "Remove to run test")]
    public void Decode_with_three_rails()
    {
        var msg = "TEITELHDVLSNHDTISEIIEA";
        var sut = new RailFenceCipher(3);
        var expected = "THEDEVILISINTHEDETAILS";
        Assert.Equal(expected, sut.Decode(msg));
    }

    [Fact(Skip = "Remove to run test")]
    public void Decode_with_five_rails()
    {
        var msg = "EIEXMSMESAORIWSCE";
        var sut = new RailFenceCipher(5);
        var expected = "EXERCISMISAWESOME";
        Assert.Equal(expected, sut.Decode(msg));
    }

    [Fact(Skip = "Remove to run test")]
    public void Decode_with_six_rails()
    {
        var msg = "133714114238148966225439541018335470986172518171757571896261";
        var sut = new RailFenceCipher(6);
        var expected = "112358132134558914423337761098715972584418167651094617711286";
        Assert.Equal(expected, sut.Decode(msg));
    }
}