Update tests which set Files lists directly

This commit is contained in:
Dean Herbert 2021-11-24 13:49:38 +09:00
parent 99a139dc98
commit c2f8d9f677
6 changed files with 22 additions and 30 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Moq; using Moq;
@ -33,14 +32,14 @@ namespace osu.Game.Tests.Editing.Checks
{ {
BeatmapSet = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
Files = new List<BeatmapSetFileInfo>(new[] Files =
{ {
new BeatmapSetFileInfo new BeatmapSetFileInfo
{ {
Filename = "abc123.mp4", Filename = "abc123.mp4",
FileInfo = new FileInfo { Hash = "abcdef" } FileInfo = new FileInfo { Hash = "abcdef" }
} }
}) }
} }
} }
}; };

View File

@ -1,7 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic; using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Editing.Checks
Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" }, Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" },
BeatmapSet = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
Files = new List<BeatmapSetFileInfo>(new[] Files =
{ {
new BeatmapSetFileInfo new BeatmapSetFileInfo
{ {
@ -43,7 +43,7 @@ namespace osu.Game.Tests.Editing.Checks
Hash = "abcdef" Hash = "abcdef"
} }
} }
}) }
} }
} }
}; };
@ -54,7 +54,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(System.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);
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -30,14 +29,14 @@ namespace osu.Game.Tests.Editing.Checks
Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" }, Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" },
BeatmapSet = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
Files = new List<BeatmapSetFileInfo>(new[] Files =
{ {
new BeatmapSetFileInfo new BeatmapSetFileInfo
{ {
Filename = "abc123.jpg", Filename = "abc123.jpg",
FileInfo = new FileInfo { Hash = "abcdef" } FileInfo = new FileInfo { Hash = "abcdef" }
} }
}) }
} }
} }
}; };

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using ManagedBass; using ManagedBass;
@ -34,14 +33,14 @@ namespace osu.Game.Tests.Editing.Checks
{ {
BeatmapSet = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
Files = new List<BeatmapSetFileInfo>(new[] Files =
{ {
new BeatmapSetFileInfo new BeatmapSetFileInfo
{ {
Filename = "abc123.wav", Filename = "abc123.wav",
FileInfo = new FileInfo { Hash = "abcdef" } FileInfo = new FileInfo { Hash = "abcdef" }
} }
}) }
} }
} }
}; };

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using Moq; using Moq;
@ -30,14 +29,14 @@ namespace osu.Game.Tests.Editing.Checks
{ {
BeatmapSet = new BeatmapSetInfo BeatmapSet = new BeatmapSetInfo
{ {
Files = new List<BeatmapSetFileInfo>(new[] Files =
{ {
new BeatmapSetFileInfo new BeatmapSetFileInfo
{ {
Filename = "abc123.jpg", Filename = "abc123.jpg",
FileInfo = new FileInfo { Hash = "abcdef" } FileInfo = new FileInfo { Hash = "abcdef" }
} }
}) }
} }
} }
}; };

View File

@ -91,23 +91,19 @@ namespace osu.Game.Tests.Beatmaps
{ {
AddStep("setup skins", () => AddStep("setup skins", () =>
{ {
userSkinInfo.Files = new List<SkinFileInfo> userSkinInfo.Files.Clear();
{ userSkinInfo.Files.Add(new SkinFileInfo
new SkinFileInfo
{ {
Filename = userFile, Filename = userFile,
FileInfo = new IO.FileInfo { Hash = userFile } FileInfo = new IO.FileInfo { Hash = userFile }
} });
};
beatmapInfo.BeatmapSet.Files = new List<BeatmapSetFileInfo> beatmapInfo.BeatmapSet.Files.Clear();
{ beatmapInfo.BeatmapSet.Files.Add(new BeatmapSetFileInfo
new BeatmapSetFileInfo
{ {
Filename = beatmapFile, Filename = beatmapFile,
FileInfo = new IO.FileInfo { Hash = beatmapFile } FileInfo = new IO.FileInfo { Hash = beatmapFile }
} });
};
// Need to refresh the cached skin source to refresh the skin resource store. // Need to refresh the cached skin source to refresh the skin resource store.
dependencies.SkinSource = new SkinProvidingContainer(Skin = new LegacySkin(userSkinInfo, this)); dependencies.SkinSource = new SkinProvidingContainer(Skin = new LegacySkin(userSkinInfo, this));