File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
exercises/practice/simple-cipher Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,13 @@ public class {{ testClass }}
2929 Assert.Equal({ {- test.expected | string.literal } }, sut.Decode({ { test | decode_arg } }));
3030 { {- else if test.property == " key" } }
3131 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, keys.Length);
3239 {{ end -} }
3340 }
3441 { { 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 , keys . 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