public void Decodes(string input, string expected) { var encoder = new CaesarEncoder(-2); var encoded = encoder.Encode(input); Assert.Equal(expected, encoded); }
public void EncodesAndDecodesToSameString(string input, int shift) { var encoder = new CaesarEncoder(shift); var encoded = encoder.Encode(input); var decoded = encoder.Decode(encoded); Assert.Equal(input, decoded); }
public void DecodedStringIsTheSame([Random(100)] int key) { var message = RandomMessage; var encoded = encoder.Encode(message, key); var decoded = encoder.Decode(encoded, key); Assert.AreEqual(message, decoded); }
public void DecodedStringIsTheSame([Random(100)] int key) { // Arrange var encoder = new CaesarEncoder(); var random = new Randomizer(); var message = random.GetString(); // Act var encoded = encoder.Encode(message, key); var decoded = encoder.Decode(encoded, key); // Assert Assert.AreEqual(message, decoded); }
public void Should_Encode_And_Decode_String() { // Arrange var ce = new CaesarEncoder(1234); var message = "encrypt_and_decrypt"; // Act var encodedMessage = ce.Encode(message); var decodedMessage = ce.Decode(encodedMessage); // Assert Assert.True(string.Equals(decodedMessage, message), $"Expected: {message}; Actual: {decodedMessage}"); }
public void Should_Encode_String() { // Arrange var ce = new CaesarEncoder(1234); var message = "test_string"; var expected = "RjdFRjFFRkQ7QDk="; // Act var encodedMessage = ce.Encode(message); // Assert Assert.True(string.Equals(encodedMessage, expected), $"Expected: {expected}; Actual: {encodedMessage}"); }