1
exercism fetch csharp crypto-square

CryptoSquareTest.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
61
62
// This file was auto-generated based on version 3.1.0 of the canonical data.

using Xunit;

public class CryptoSquareTest
{
    [Fact]
    public void Empty_plaintext_results_in_an_empty_ciphertext()
    {
        var plaintext = "";
        var expected = "";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Lowercase()
    {
        var plaintext = "A";
        var expected = "a";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Remove_spaces()
    {
        var plaintext = "  b ";
        var expected = "b";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Remove_punctuation()
    {
        var plaintext = "@1,%!";
        var expected = "1";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Number_9_character_plaintext_results_in_3_chunks_of_3_characters()
    {
        var plaintext = "This is fun!";
        var expected = "tsf hiu isn";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Number_8_character_plaintext_results_in_3_chunks_the_last_one_with_a_trailing_space()
    {
        var plaintext = "Chill out.";
        var expected = "clu hlt io ";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }

    [Fact(Skip = "Remove to run test")]
    public void Number_54_character_plaintext_results_in_7_chunks_the_last_two_with_trailing_spaces()
    {
        var plaintext = "If man was meant to stay on the ground, god would have given us roots.";
        var expected = "imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn  sseoau ";
        Assert.Equal(expected, CryptoSquare.Ciphertext(plaintext));
    }
}