Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions exercises/practice/simple-cipher/.meta/Generator.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ end}}
end
end}}

using Xunit;

public class {{ testClass }}
{
{{- for test in tests }}
Expand All @@ -31,6 +29,13 @@ public class {{ testClass }}
Assert.Equal({{- test.expected | string.literal }}, sut.Decode({{ test | decode_arg }}));
{{- else if test.property == "key" }}
Assert.Matches({{- test.expected.match | string.literal }}, sut.Key);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Random_key_cipher_key_is_random()
{
var keys = Enumerable.Range(0, 1000).Select(_ => new SimpleCipher().Key).ToArray();
Assert.InRange(keys.Distinct().Count(), keys.Length - 100, keys.Length);
{{ end -}}
}
{{ end -}}
Expand Down
7 changes: 7 additions & 0 deletions exercises/practice/simple-cipher/SimpleCipherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public void Random_key_cipher_key_is_made_only_of_lowercase_letters()
Assert.Matches("^[a-z]+$", sut.Key);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Random_key_cipher_key_is_random()
{
var keys = Enumerable.Range(0, 1000).Select(_ => new SimpleCipher().Key).ToArray();
Assert.InRange(keys.Distinct().Count(), keys.Length - 100, keys.Length);
}

[Fact(Skip = "Remove this Skip property to run this test")]
public void Substitution_cipher_can_encode()
{
Expand Down
Loading