mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:52:57 +08:00
Add test coverage for ruleset load failure scenario
This commit is contained in:
parent
8b134914cf
commit
8528cab40b
@ -5,6 +5,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -62,6 +63,17 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
working.ResetEvent.Set();
|
working.ResetEvent.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestGetPlayableRulesetLoadFailure()
|
||||||
|
{
|
||||||
|
var working = new TestWorkingBeatmap(new Beatmap());
|
||||||
|
|
||||||
|
// by default mocks return nulls if not set up, which is actually desired here to simulate a ruleset load failure scenario.
|
||||||
|
var ruleset = new Mock<IRulesetInfo>();
|
||||||
|
|
||||||
|
Assert.Throws<RulesetLoadException>(() => working.GetPlayableBeatmap(ruleset.Object));
|
||||||
|
}
|
||||||
|
|
||||||
public class TestNeverLoadsWorkingBeatmap : TestWorkingBeatmap
|
public class TestNeverLoadsWorkingBeatmap : TestWorkingBeatmap
|
||||||
{
|
{
|
||||||
public ManualResetEventSlim ResetEvent = new ManualResetEventSlim();
|
public ManualResetEventSlim ResetEvent = new ManualResetEventSlim();
|
||||||
|
Loading…
Reference in New Issue
Block a user