public void Encrypt_ShouldEncryptFile_OpenSSLTest() { Output result = AesEncryptTask.AesEncryptFile( new Input { SourceFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestFiles\SourceFile.txt"), DestinationFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestFiles\Encrypted_OpenSSL.ed"), Password = "******" }, new Options { CipherMode = Cipher.CBC, KeySize = KeySize.AES256, PaddingMode = Padding.PKCS7, ByteArrayLength = ByteArrayLength.Eight, DecryptionMethod = DecryptionMethod.OpenSSL }); FileInfo fi = new FileInfo(result.OutputPath); Assert.IsTrue(fi.Exists); }
public void Encrypt_ShouldThrowArgumentExceptionWithNonexistingSourceFile() { try { AesEncryptTask.AesEncryptFile( new Input { SourceFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"..\..\..\TestFiles\SourceFileThatDoesNotExist.txt"), Password = "******" }, new Options { CipherMode = Cipher.CBC, KeySize = KeySize.AES256, PaddingMode = Padding.PKCS7, ByteArrayLength = ByteArrayLength.Sixteen, DecryptionMethod = DecryptionMethod.Other }); Assert.Fail(); } catch (ArgumentException e) { Assert.AreEqual("Source file does not exist!\r\nParameter name: Input.SourcePath", e.Message); } }