From 5931e965c5818f018950cdf505fed18ae687c05b Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 5 Nov 2022 16:16:26 +0800 Subject: [PATCH] Mark background prams in the `getMockWorkingBeatmap()` as nun-nullable because technically it should not accept the null background. --- .../Editing/Checks/CheckBackgroundQualityTest.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs index 1aead6d78c..295a10ba5b 100644 --- a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs @@ -6,7 +6,6 @@ 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; @@ -46,7 +45,7 @@ public void TestMissing() { // While this is a problem, it is out of scope for this check and is caught by a different one. beatmap.Metadata.BackgroundFile = string.Empty; - var context = getContext(null, new MemoryStream(Array.Empty())); + var context = getContext(null!, new MemoryStream(Array.Empty())); Assert.That(check.Run(context), Is.Empty); } @@ -116,7 +115,7 @@ public void TestStreamClosed() stream.Verify(x => x.Close(), Times.Once()); } - private BeatmapVerifierContext getContext(Texture? background, Stream? stream = null) + private BeatmapVerifierContext getContext(Texture background, Stream? stream = null) { return new BeatmapVerifierContext(beatmap, getMockWorkingBeatmap(background, stream).Object); } @@ -126,13 +125,13 @@ private BeatmapVerifierContext getContext(Texture? background, Stream? stream = /// /// The texture of the background. /// The stream representing the background file. - private Mock getMockWorkingBeatmap(Texture? background, Stream? stream = null) + private Mock getMockWorkingBeatmap(Texture background, Stream? stream = null) { stream ??= new MemoryStream(new byte[1024 * 1024]); var mock = new Mock(); mock.SetupGet(w => w.Beatmap).Returns(beatmap); - mock.SetupGet(w => w.Background).Returns(background.AsNonNull()); + mock.SetupGet(w => w.Background).Returns(background); mock.Setup(w => w.GetStream(It.IsAny())).Returns(stream); return mock;