Пример #1
0
    public void Substitution_cipher_can_handle_messages_longer_than_the_key()
    {
        var sut = new SimpleCipher("abc");

        Assert.Equal("iboaqcnecbfcr", sut.Encode("iamapandabear"));
    }
Пример #2
0
    public void Random_key_cipher_can_encode()
    {
        var sut = new SimpleCipher();

        Assert.Equal(sut.Key.Substring(0, 10), sut.Encode("aaaaaaaaaa"));
    }
Пример #3
0
    public void Substitution_cipher_can_double_shift_encode()
    {
        var sut = new SimpleCipher("iamapandabear");

        Assert.Equal("qayaeaagaciai", sut.Encode("iamapandabear"));
    }
Пример #4
0
    public void Substitution_cipher_can_wrap_on_encode()
    {
        var sut = new SimpleCipher("abcdefghij");

        Assert.Equal("zabcdefghi", sut.Encode("zzzzzzzzzz"));
    }
Пример #5
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")));
    }