2020-02-11 00:30:38 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-03-26 04:25:48 +00:00
|
|
|
|
using Xunit;
|
2020-02-11 00:30:38 +00:00
|
|
|
|
|
2020-03-26 04:25:48 +00:00
|
|
|
|
namespace Wabbajack.Common.Test
|
2020-02-10 23:25:24 +00:00
|
|
|
|
{
|
|
|
|
|
public class EncryptedDataTests
|
|
|
|
|
{
|
2020-02-11 00:30:38 +00:00
|
|
|
|
|
2020-03-26 04:25:48 +00:00
|
|
|
|
[Fact]
|
2020-02-11 00:30:38 +00:00
|
|
|
|
public async Task CanDetectNewEncryptedData()
|
|
|
|
|
{
|
|
|
|
|
var test_string = Guid.NewGuid().ToString();
|
|
|
|
|
var data = new ConcurrentBag<string>();
|
|
|
|
|
var events = Utils.HaveEncryptedJsonObservable(test_string).Subscribe(e =>
|
|
|
|
|
{
|
|
|
|
|
if (e)
|
|
|
|
|
data.Add(test_string);
|
|
|
|
|
else
|
|
|
|
|
data.Clear();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
test_string.ToEcryptedJson(test_string);
|
|
|
|
|
await Task.Delay(100);
|
|
|
|
|
|
2020-03-26 04:25:48 +00:00
|
|
|
|
Assert.Contains(test_string, data);
|
2020-02-11 00:30:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2020-02-10 23:25:24 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|