// The plain text will be padded to fill the size of block (16 bytes), so the encoded message should be aligned with the rule // (text.Length % 16 == 0) public static void TestEncodedMessageSize(string testCase, uint key) { // Arrange var encoder = new FeistelCipher(); // Assert Assert.Throws <ArgumentException>(() => encoder.Decode(testCase, key)); }
public static void DecodedStringIsTheSame([Random(100)] uint key) { // Arrange var encoder = new FeistelCipher(); var random = new Randomizer(); int lenOfString = random.Next(1000); string message = random.GetString(lenOfString); // Act var encoded = encoder.Encode(message, key); var decoded = encoder.Decode(encoded, key); // Assert Assert.AreEqual(message, decoded); }