From c2f8d9f677d505e0b82bb76e8c1b589870d8827c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 24 Nov 2021 13:49:38 +0900 Subject: [PATCH] Update tests which set `Files` lists directly --- .../Editing/Checks/CheckAudioInVideoTest.cs | 5 ++-- .../Checks/CheckBackgroundQualityTest.cs | 8 +++---- .../Editing/Checks/CheckFilePresenceTest.cs | 5 ++-- .../Checks/CheckTooShortAudioFilesTest.cs | 5 ++-- .../Editing/Checks/CheckZeroByteFilesTest.cs | 5 ++-- .../Tests/Beatmaps/HitObjectSampleTest.cs | 24 ++++++++----------- 6 files changed, 22 insertions(+), 30 deletions(-) diff --git a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs index f3a4f10210..f9b16990ef 100644 --- a/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckAudioInVideoTest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.IO; using System.Linq; using Moq; @@ -33,14 +32,14 @@ namespace osu.Game.Tests.Editing.Checks { BeatmapSet = new BeatmapSetInfo { - Files = new List(new[] + Files = { new BeatmapSetFileInfo { Filename = "abc123.mp4", FileInfo = new FileInfo { Hash = "abcdef" } } - }) + } } } }; diff --git a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs index 05bfae7e63..5a45857e5c 100644 --- a/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckBackgroundQualityTest.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; +using System; using System.IO; using System.Linq; using JetBrains.Annotations; @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Editing.Checks Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" }, BeatmapSet = new BeatmapSetInfo { - Files = new List(new[] + Files = { new BeatmapSetFileInfo { @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Editing.Checks 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. beatmap.Metadata.BackgroundFile = string.Empty; - var context = getContext(null, new MemoryStream(System.Array.Empty())); + var context = getContext(null, new MemoryStream(Array.Empty())); Assert.That(check.Run(context), Is.Empty); } diff --git a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs index 70e4c76b19..59dfc88923 100644 --- a/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckFilePresenceTest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps; @@ -30,14 +29,14 @@ namespace osu.Game.Tests.Editing.Checks Metadata = new BeatmapMetadata { BackgroundFile = "abc123.jpg" }, BeatmapSet = new BeatmapSetInfo { - Files = new List(new[] + Files = { new BeatmapSetFileInfo { Filename = "abc123.jpg", FileInfo = new FileInfo { Hash = "abcdef" } } - }) + } } } }; diff --git a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs index 9b090591bc..64285cd46e 100644 --- a/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckTooShortAudioFilesTest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.IO; using System.Linq; using ManagedBass; @@ -34,14 +33,14 @@ namespace osu.Game.Tests.Editing.Checks { BeatmapSet = new BeatmapSetInfo { - Files = new List(new[] + Files = { new BeatmapSetFileInfo { Filename = "abc123.wav", FileInfo = new FileInfo { Hash = "abcdef" } } - }) + } } } }; diff --git a/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs b/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs index c9adc030c1..1a581cc27d 100644 --- a/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs +++ b/osu.Game.Tests/Editing/Checks/CheckZeroByteFilesTest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using System.IO; using System.Linq; using Moq; @@ -30,14 +29,14 @@ namespace osu.Game.Tests.Editing.Checks { BeatmapSet = new BeatmapSetInfo { - Files = new List(new[] + Files = { new BeatmapSetFileInfo { Filename = "abc123.jpg", FileInfo = new FileInfo { Hash = "abcdef" } } - }) + } } } }; diff --git a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs index b87c3d57c2..127c853a8e 100644 --- a/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs +++ b/osu.Game/Tests/Beatmaps/HitObjectSampleTest.cs @@ -91,23 +91,19 @@ namespace osu.Game.Tests.Beatmaps { AddStep("setup skins", () => { - userSkinInfo.Files = new List + userSkinInfo.Files.Clear(); + userSkinInfo.Files.Add(new SkinFileInfo { - new SkinFileInfo - { - Filename = userFile, - FileInfo = new IO.FileInfo { Hash = userFile } - } - }; + Filename = userFile, + FileInfo = new IO.FileInfo { Hash = userFile } + }); - beatmapInfo.BeatmapSet.Files = new List + beatmapInfo.BeatmapSet.Files.Clear(); + beatmapInfo.BeatmapSet.Files.Add(new BeatmapSetFileInfo { - new BeatmapSetFileInfo - { - Filename = beatmapFile, - FileInfo = new IO.FileInfo { Hash = beatmapFile } - } - }; + Filename = beatmapFile, + FileInfo = new IO.FileInfo { Hash = beatmapFile } + }); // Need to refresh the cached skin source to refresh the skin resource store. dependencies.SkinSource = new SkinProvidingContainer(Skin = new LegacySkin(userSkinInfo, this));