mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 22:23:22 +08:00
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.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Moq;
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Extensions.ObjectExtensions;
|
|
||||||
using osu.Framework.Graphics.Rendering.Dummy;
|
using osu.Framework.Graphics.Rendering.Dummy;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -46,7 +45,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
{
|
{
|
||||||
// While this is a problem, it is out of scope for this check and is caught by a different one.
|
// 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;
|
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);
|
Assert.That(check.Run(context), Is.Empty);
|
||||||
}
|
}
|
||||||
@ -116,7 +115,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
stream.Verify(x => x.Close(), Times.Once());
|
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);
|
return new BeatmapVerifierContext(beatmap, getMockWorkingBeatmap(background, stream).Object);
|
||||||
}
|
}
|
||||||
@ -126,13 +125,13 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="background">The texture of the background.</param>
|
/// <param name="background">The texture of the background.</param>
|
||||||
/// <param name="stream">The stream representing the background file.</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]);
|
stream ??= new MemoryStream(new byte[1024 * 1024]);
|
||||||
|
|
||||||
var mock = new Mock<IWorkingBeatmap>();
|
var mock = new Mock<IWorkingBeatmap>();
|
||||||
mock.SetupGet(w => w.Beatmap).Returns(beatmap);
|
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);
|
mock.Setup(w => w.GetStream(It.IsAny<string>())).Returns(stream);
|
||||||
|
|
||||||
return mock;
|
return mock;
|
||||||
|
Loading…
Reference in New Issue
Block a user