2018-11-04 20:33:37 +00:00
|
|
|
|
using Roadie.Library.Utility;
|
|
|
|
|
using System;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Roadie.Library.Tests
|
|
|
|
|
{
|
|
|
|
|
public class EncryptionHelperTests
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
2019-11-04 03:19:04 +00:00
|
|
|
|
public void EncryptAndDecrypt()
|
2018-11-04 20:33:37 +00:00
|
|
|
|
{
|
|
|
|
|
var key = Guid.NewGuid().ToString();
|
|
|
|
|
var value = Guid.NewGuid().ToString();
|
|
|
|
|
|
|
|
|
|
var encrypted = EncryptionHelper.Encrypt(value, key);
|
|
|
|
|
Assert.NotNull(encrypted);
|
|
|
|
|
Assert.NotEqual(encrypted, value);
|
|
|
|
|
|
|
|
|
|
var decrypted = EncryptionHelper.Decrypt(encrypted, key);
|
|
|
|
|
Assert.NotNull(decrypted);
|
|
|
|
|
Assert.Equal(decrypted, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-17 20:03:52 +00:00
|
|
|
|
}
|