From 8528cab40b862c4b03c27c8543ebb9c95f6ea15d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Wed, 17 Nov 2021 22:07:24 +0100 Subject: [PATCH] Add test coverage for ruleset load failure scenario --- osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs b/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs index 02e4a87a7a..6ad63a5fbb 100644 --- a/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/WorkingBeatmapTest.cs @@ -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(); + + Assert.Throws(() => working.GetPlayableBeatmap(ruleset.Object)); + } + public class TestNeverLoadsWorkingBeatmap : TestWorkingBeatmap { public ManualResetEventSlim ResetEvent = new ManualResetEventSlim();