wabbajack/Wabbajack.Common.Test/EncryptedDataTests.cs

34 lines
793 B
C#
Raw Permalink Normal View History

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