mirror of
https://github.com/ppy/osu
synced 2025-02-17 10:57:03 +00:00
Add test coverage of async writes during a blocking operation
This commit is contained in:
parent
e10ac45fd7
commit
d64959ad0c
@ -49,6 +49,27 @@ namespace osu.Game.Tests.Database
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[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]
|
[Test]
|
||||||
public void TestAsyncWrite()
|
public void TestAsyncWrite()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user