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:
parent
c100d1ab65
commit
c8b9c117cd
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user