public void WhenClearTextIsNull_ThenThrowException() { var keyIv = _keyFactoryRijndael.Create(Password, Salt.GetBytes()); var sut = CreateSut(_rijndaelAlgo, keyIv); Assert.Throws <ArgumentException>(() => sut.Encrypt(null)); }
public void WhenSourceAndSaltSupplied_ThenEncryptText() { var keyIv = _keyFactoryRijndael.Create(Password, Salt.GetBytes()); var sut = CreateSut(_rijndaelAlgo, keyIv); var ciphertext = sut.Encrypt(ClearText); Assert.That(ciphertext, Is.Not.EqualTo(ClearText)); }
public void WhenDifferentAlgorithms_ThenDifferentCiphers() { var keyIvRij = _keyFactoryRijndael.Create(Password, Salt.GetBytes()); var keyIvTDes = _keyFactoryTripleDes.Create(Password, Salt.GetBytes()); var sutRij = CreateSut(_rijndaelAlgo, keyIvRij); var sutTripleDes = CreateSut(_tripleDesAlgo, keyIvTDes); var cipherText1 = sutRij.Encrypt(ClearText); var cipherText2 = sutTripleDes.Encrypt(ClearText); Assert.That(cipherText1, Is.Not.EqualTo(cipherText2)); }