mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Add test coverage of async writes during a blocking operation
This commit is contained in:
@ -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]
|
||||
public void TestAsyncWrite()
|
||||
{
|
||||
|
Reference in New Issue
Block a user