1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:42:57 +08:00

Add test coverage for ruleset load failure scenario

This commit is contained in:
Bartłomiej Dach 2021-11-17 22:07:24 +01:00
parent 8b134914cf
commit 8528cab40b
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
@ -62,6 +63,17 @@ namespace osu.Game.Tests.Beatmaps
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 ManualResetEventSlim ResetEvent = new ManualResetEventSlim();