1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Use AsNonNull() because the type does not accept the null case.

This commit is contained in:
andy840119 2022-10-30 16:55:53 +08:00
parent 500bf90a34
commit c8c76f2351
3 changed files with 6 additions and 3 deletions

View File

@ -5,6 +5,7 @@ using System.Linq;
using Moq;
using NUnit.Framework;
using osu.Framework.Audio.Track;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
@ -41,7 +42,7 @@ namespace osu.Game.Tests.Editing.Checks
var mock = new Mock<IWorkingBeatmap>();
mock.SetupGet(w => w.Beatmap).Returns(beatmap);
mock.SetupGet(w => w.Track).Returns((Track)null);
mock.SetupGet(w => w.Track).Returns(default(Track?).AsNonNull());
Assert.That(check.Run(new BeatmapVerifierContext(beatmap, mock.Object)), Is.Empty);
}

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using Moq;
using NUnit.Framework;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Rendering.Dummy;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
@ -131,7 +132,7 @@ namespace osu.Game.Tests.Editing.Checks
var mock = new Mock<IWorkingBeatmap>();
mock.SetupGet(w => w.Beatmap).Returns(beatmap);
mock.SetupGet(w => w.Background).Returns(background);
mock.SetupGet(w => w.Background).Returns(background.AsNonNull());
mock.Setup(w => w.GetStream(It.IsAny<string>())).Returns(stream);
return mock;

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using Moq;
using NUnit.Framework;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Checks;
@ -72,7 +73,7 @@ namespace osu.Game.Tests.Editing.Checks
private BeatmapVerifierContext getContextMissing()
{
var mockWorkingBeatmap = new Mock<IWorkingBeatmap>();
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns((Stream)null);
mockWorkingBeatmap.Setup(w => w.GetStream(It.IsAny<string>())).Returns(default(Stream?).AsNonNull());
return new BeatmapVerifierContext(beatmap, mockWorkingBeatmap.Object);
}