Beispiel #1
0
    public void Substitution_cipher_can_wrap_on_decode()
    {
        var sut = new SimpleCipher("abcdefghij");

        Assert.Equal("zzzzzzzzzz", sut.Decode("zabcdefghi"));
    }
Beispiel #2
0
    public void Random_key_cipher_can_decode()
    {
        var sut = new SimpleCipher();

        Assert.Equal("aaaaaaaaaa", sut.Decode(sut.Key.Substring(0, 10)));
    }
Beispiel #3
0
    public void Substitution_cipher_is_reversible_i_e_if_you_apply_decode_in_a_encoded_result_you_must_see_the_same_plaintext_encode_parameter_as_a_result_of_the_decode_method()
    {
        var sut = new SimpleCipher("abcdefghij");

        Assert.Equal("abcdefghij", sut.Decode(sut.Encode("abcdefghij")));
    }
Beispiel #4
0
    public void Substitution_cipher_can_decode_messages_longer_than_the_key()
    {
        var sut = new SimpleCipher("abc");

        Assert.Equal("iamapandabear", sut.Decode("iboaqcnecbfcr"));
    }