Add test coverage of async writes during a blocking operation

This commit is contained in:
Dean Herbert 2022-06-28 17:07:49 +09:00
parent e10ac45fd7
commit d64959ad0c
1 changed files with 21 additions and 0 deletions

View File

@ -49,6 +49,27 @@ public void TestAsyncWriteAsync()
});
}
[Test]
public void TestAsyncWriteWhileBlocking()
{
RunTestWithRealm((realm, _) =>
{
Task writeTask;
using (realm.BlockAllOperations())
{
writeTask = realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo()));
Thread.Sleep(100);
Assert.That(writeTask.IsCompleted, Is.False);
}
writeTask.WaitSafely();
realm.Run(r => r.Refresh());
Assert.That(realm.Run(r => r.All<BeatmapSetInfo>().Count()), Is.EqualTo(1));
});
}
[Test]
public void TestAsyncWrite()
{