mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 08:43:01 +08:00
Add test coverage of nested rollback for good measure
This commit is contained in:
parent
ac216d94a8
commit
bf10f2db2e
@ -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()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user