mirror of https://github.com/ppy/osu
Add test coverage of async writes during a blocking operation
This commit is contained in:
parent
e10ac45fd7
commit
d64959ad0c
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue