1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-22 01:59:53 +08:00

Add test coverage of nested rollback for good measure

This commit is contained in:
Dean Herbert
2022-07-07 18:19:01 +09:00
Unverified
parent ac216d94a8
commit bf10f2db2e
+21
View File
@@ -77,6 +77,27 @@ namespace osu.Game.Tests.Database
});
}
[Test]
public void TestFailedNestedWritePerformsRollback()
{
RunTestWithRealm((realm, _) =>
{
Assert.Throws<InvalidOperationException>(() =>
{
realm.Write(r =>
{
realm.Write(_ =>
{
r.Add(new BeatmapInfo(CreateRuleset(), new BeatmapDifficulty(), new BeatmapMetadata()));
throw new InvalidOperationException();
});
});
});
Assert.That(realm.Run(r => r.All<BeatmapInfo>()), Is.Empty);
});
}
[Test]
public void TestNestedWriteCalls()
{