// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; using NUnit.Framework; using osu.Game.Beatmaps.Legacy; using osu.Game.Rulesets; namespace osu.Game.Tests.Beatmaps { /// /// Base class for tests of converting enumeration flags to ruleset mod instances. /// public abstract class LegacyModConversionTest { /// /// Creates the whose legacy mod conversion is to be tested. /// /// protected abstract Ruleset CreateRuleset(); protected void Test(LegacyMods legacyMods, Type[] expectedMods) { var ruleset = CreateRuleset(); var mods = ruleset.ConvertFromLegacyMods(legacyMods).ToList(); Assert.AreEqual(expectedMods.Length, mods.Count); foreach (var modType in expectedMods) { Assert.IsNotNull(mods.SingleOrDefault(mod => mod.GetType() == modType)); } } } }