1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 19:27:31 +08:00

Add failing test showing realm not sending through null ChangeSet

This commit is contained in:
Dean Herbert 2024-07-09 15:47:41 +09:00
parent c100d1ab65
commit c8b9c117cd
No known key found for this signature in database

View File

@ -71,6 +71,35 @@ namespace osu.Game.Tests.Database
}
}
[Test]
public void TestSubscriptionInitialChangeSetNull()
{
ChangeSet? firstChanges = null;
int receivedChangesCount = 0;
RunTestWithRealm((realm, _) =>
{
var registration = realm.RegisterForNotifications(r => r.All<BeatmapSetInfo>(), onChanged);
realm.WriteAsync(r => r.Add(TestResources.CreateTestBeatmapSetInfo())).WaitSafely();
realm.Run(r => r.Refresh());
Assert.That(receivedChangesCount, Is.EqualTo(2));
Assert.That(firstChanges, Is.Null);
registration.Dispose();
});
void onChanged(IRealmCollection<BeatmapSetInfo> sender, ChangeSet? changes)
{
if (receivedChangesCount == 0)
firstChanges = changes;
receivedChangesCount++;
}
}
[Test]
public void TestSubscriptionWithAsyncWrite()
{