mirror of https://github.com/ppy/osu
Mark background prams in the `getMockWorkingBeatmap()` as nun-nullable because technically it should not accept the null background.
This commit is contained in:
parent
c8c76f2351
commit
5931e965c5
|
@ -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<byte>()));
|
||||
var context = getContext(null!, new MemoryStream(Array.Empty<byte>()));
|
||||
|
||||
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 =
|
|||
/// </summary>
|
||||
/// <param name="background">The texture of the background.</param>
|
||||
/// <param name="stream">The stream representing the background file.</param>
|
||||
private Mock<IWorkingBeatmap> getMockWorkingBeatmap(Texture? background, Stream? stream = null)
|
||||
private Mock<IWorkingBeatmap> getMockWorkingBeatmap(Texture background, Stream? stream = null)
|
||||
{
|
||||
stream ??= new MemoryStream(new byte[1024 * 1024]);
|
||||
|
||||
var mock = new Mock<IWorkingBeatmap>();
|
||||
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<string>())).Returns(stream);
|
||||
|
||||
return mock;
|
||||
|
|
Loading…
Reference in New Issue