using System.Collections; using System.Collections.Generic; using NUnit.Framework; namespace Assets.Data { [TestFixture] public class TestTraitsMapping { [Test] [TestCaseSource(typeof(TraitsMappingCase), "ChampCombination")] public void TestChampCombination( long mandatoryChamps, long possibleChamps, int n, List expected ) { List output = TraitsMapping.GenerateCombinations( mandatoryChamps, possibleChamps, n ); foreach (long champ in expected) { Assert.IsTrue(output.Contains(champ)); } foreach (long champ in output) { Assert.IsTrue(expected.Contains(champ)); } } } public class TraitsMappingCase { public static IEnumerable ChampCombination { get { yield return new TestCaseData( ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, } ), ChampionUtils.ToLong(new HashSet() { ChampionsEnum.ELISE }), 3, new List() { ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, ChampionsEnum.ELISE, } ), } ); yield return new TestCaseData( ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, } ), ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ELISE, ChampionsEnum.AHRI, ChampionsEnum.CASSIOPEIA, ChampionsEnum.EZREAL } ), 5, new List() { ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, ChampionsEnum.ELISE, ChampionsEnum.AHRI, ChampionsEnum.CASSIOPEIA } ), ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, ChampionsEnum.ELISE, ChampionsEnum.AHRI, ChampionsEnum.EZREAL } ), ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, ChampionsEnum.ELISE, ChampionsEnum.CASSIOPEIA, ChampionsEnum.EZREAL } ), ChampionUtils.ToLong( new HashSet() { ChampionsEnum.ASHE, ChampionsEnum.BLITZCRANK, ChampionsEnum.AHRI, ChampionsEnum.CASSIOPEIA, ChampionsEnum.EZREAL } ), } ); yield return new TestCaseData( ChampionUtils.ToLong(new HashSet() { ChampionsEnum.ELISE }), ChampionUtils.ToLong(new HashSet() { ChampionsEnum.AHRI }), 1, new List() { ChampionUtils.ToLong(new HashSet() { ChampionsEnum.ELISE }), } ); yield return new TestCaseData( ChampionUtils.ToLong( new HashSet() { ChampionsEnum.AHRI, ChampionsEnum.POPPY, ChampionsEnum.SORAKA, ChampionsEnum.HWEI, } ), ChampionUtils.ToLong( new HashSet() { ChampionsEnum.SMOLDER, ChampionsEnum.XERATH } ), 4, new List() { ChampionUtils.ToLong( new HashSet() { ChampionsEnum.AHRI, ChampionsEnum.POPPY, ChampionsEnum.SORAKA, ChampionsEnum.HWEI, } ), } ); } } } }