Encrypter/Encrypter Tests/EncrypterTests.cs

26 lines
818 B
C#
Raw Normal View History

2020-01-05 18:31:34 +00:00
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Encrypter;
using NUnit.Framework;
namespace Encrypter_Tests
{
public sealed class EncrypterTests
{
[Test]
public async Task TestSimpleEnAndDecryption()
{
var message = "This is a test with umlauts äüö.";
var password = "test password";
var encryptedData = await CryptoProcessor.EncryptString(message, password);
Assert.That(encryptedData.Length, Is.AtLeast(message.Length)); // Note: Encrypted data contains salt as well!
var decryptedMessage = await CryptoProcessor.DecryptString(encryptedData, password);
Assert.That(decryptedMessage, Is.EqualTo(message));
}
}
}