Skip to content

Commit 8ddd860

Browse files
Add rotational-cipher
1 parent 9f5cc64 commit 8ddd860

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Xunit;
2+
3+
public class RotationalCipherTests
4+
{
5+
{{#test_cases}}
6+
[Fact{{#unless @first}}(Skip = "Remove this Skip property to run this test"){{/unless}}]
7+
public void {{test_method_name}}()
8+
{
9+
Assert.Equal({{expected}}, RotationalCipher.Rotate({{lit input.text}}, {{input.shiftKey}}));
10+
}
11+
{{/test_cases}}
12+
}

exercises/practice/rotational-cipher/RotationalCipherTests.cs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,62 @@
33
public class RotationalCipherTests
44
{
55
[Fact]
6-
public void Rotate_a_by_0_same_output_as_input()
6+
public void RotateABy0SameOutputAsInput()
77
{
8-
Assert.Equal("a", RotationalCipher.Rotate("a", 0));
8+
Assert.Equal(a, RotationalCipher.Rotate("a", 0));
99
}
1010

1111
[Fact(Skip = "Remove this Skip property to run this test")]
12-
public void Rotate_a_by_1()
12+
public void RotateABy1()
1313
{
14-
Assert.Equal("b", RotationalCipher.Rotate("a", 1));
14+
Assert.Equal(b, RotationalCipher.Rotate("a", 1));
1515
}
1616

1717
[Fact(Skip = "Remove this Skip property to run this test")]
18-
public void Rotate_a_by_26_same_output_as_input()
18+
public void RotateABy26SameOutputAsInput()
1919
{
20-
Assert.Equal("a", RotationalCipher.Rotate("a", 26));
20+
Assert.Equal(a, RotationalCipher.Rotate("a", 26));
2121
}
2222

2323
[Fact(Skip = "Remove this Skip property to run this test")]
24-
public void Rotate_m_by_13()
24+
public void RotateMBy13()
2525
{
26-
Assert.Equal("z", RotationalCipher.Rotate("m", 13));
26+
Assert.Equal(z, RotationalCipher.Rotate("m", 13));
2727
}
2828

2929
[Fact(Skip = "Remove this Skip property to run this test")]
30-
public void Rotate_n_by_13_with_wrap_around_alphabet()
30+
public void RotateNBy13WithWrapAroundAlphabet()
3131
{
32-
Assert.Equal("a", RotationalCipher.Rotate("n", 13));
32+
Assert.Equal(a, RotationalCipher.Rotate("n", 13));
3333
}
3434

3535
[Fact(Skip = "Remove this Skip property to run this test")]
36-
public void Rotate_capital_letters()
36+
public void RotateCapitalLetters()
3737
{
38-
Assert.Equal("TRL", RotationalCipher.Rotate("OMG", 5));
38+
Assert.Equal(TRL, RotationalCipher.Rotate("OMG", 5));
3939
}
4040

4141
[Fact(Skip = "Remove this Skip property to run this test")]
42-
public void Rotate_spaces()
42+
public void RotateSpaces()
4343
{
44-
Assert.Equal("T R L", RotationalCipher.Rotate("O M G", 5));
44+
Assert.Equal(T R L, RotationalCipher.Rotate("O M G", 5));
4545
}
4646

4747
[Fact(Skip = "Remove this Skip property to run this test")]
48-
public void Rotate_numbers()
48+
public void RotateNumbers()
4949
{
50-
Assert.Equal("Xiwxmrk 1 2 3 xiwxmrk", RotationalCipher.Rotate("Testing 1 2 3 testing", 4));
50+
Assert.Equal(Xiwxmrk 1 2 3 xiwxmrk, RotationalCipher.Rotate("Testing 1 2 3 testing", 4));
5151
}
5252

5353
[Fact(Skip = "Remove this Skip property to run this test")]
54-
public void Rotate_punctuation()
54+
public void RotatePunctuation()
5555
{
56-
Assert.Equal("Gzo'n zvo, Bmviyhv!", RotationalCipher.Rotate("Let's eat, Grandma!", 21));
56+
Assert.Equal(Gzo 'n zvo, Bmviyhv!, RotationalCipher.Rotate("Let' s eat, Grandma!", 21));
5757
}
5858

5959
[Fact(Skip = "Remove this Skip property to run this test")]
60-
public void Rotate_all_letters()
60+
public void RotateAllLetters()
6161
{
62-
Assert.Equal("Gur dhvpx oebja sbk whzcf bire gur ynml qbt.", RotationalCipher.Rotate("The quick brown fox jumps over the lazy dog.", 13));
62+
Assert.Equal(Gur dhvpx oebja sbk whzcf bire gur ynml qbt., RotationalCipher.Rotate("The quick brown fox jumps over the lazy dog.", 13));
6363
}
6464
}

0 commit comments

Comments
 (0)