File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
exercises/practice/simple-cipher Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 1616 end
1717end} }
1818
19- using Xunit;
20-
2119public class { { testClass } }
2220{
2321 {{- for test in tests } }
@@ -31,6 +29,13 @@ public class {{ testClass }}
3129 Assert.Equal({ {- test.expected | string.literal } }, sut.Decode({ { test | decode_arg } }));
3230 { {- else if test.property == " key" } }
3331 Assert.Matches({ {- test.expected.match | string.literal } }, sut.Key);
32+ }
33+
34+ [Fact(Skip = "Remove this Skip property to run this test")]
35+ public void Random_key_cipher_key_is_random()
36+ {
37+ var keys = Enumerable.Range(0, 1000).Select(_ => new SimpleCipher().Key).ToArray();
38+ Assert.InRange(keys.Distinct().Count(), keys.Length - 100, privateKeys.Length);
3439 {{ end -} }
3540 }
3641 { { end -} }
Original file line number Diff line number Diff line change @@ -28,6 +28,13 @@ public void Random_key_cipher_key_is_made_only_of_lowercase_letters()
2828 Assert . Matches ( "^[a-z]+$" , sut . Key ) ;
2929 }
3030
31+ [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
32+ public void Random_key_cipher_key_is_random ( )
33+ {
34+ var keys = Enumerable . Range ( 0 , 1000 ) . Select ( _ => new SimpleCipher ( ) . Key ) . ToArray ( ) ;
35+ Assert . InRange ( keys . Distinct ( ) . Count ( ) , keys . Length - 100 , privateKeys . Length ) ;
36+ }
37+
3138 [ Fact ( Skip = "Remove this Skip property to run this test" ) ]
3239 public void Substitution_cipher_can_encode ( )
3340 {
You can’t perform that action at this time.
0 commit comments