public void DecryptTest_EmptyKey() { byte[] key = new byte[0]; XCrypt crypt = new XCrypt(key); byte[] cipherText = Encoding.UTF8.GetBytes("BS^DYT"); Assert.Throws <InvalidOperationException>(() => crypt.Decrypt(cipherText)); }
public void DecryptTest() { byte[] key = Encoding.UTF8.GetBytes("12345"); XCrypt crypt = new XCrypt(key); byte[] cipherText = Encoding.UTF8.GetBytes("BS^DYT"); byte[] expected = Encoding.UTF8.GetBytes("sample"); byte[] actual = crypt.Decrypt(cipherText); CollectionAssert.AreEqual(expected, actual); }