public void FinalStakersTest(int[] sums, int themesCount, int[] order) { var players = new List <GamePlayerAccount>(); for (int i = 0; i < sums.Length; i++) { players.Add(new GamePlayerAccount(new Account()) { Sum = sums[i], InGame = sums[i] > 0 }); } var enumerator = new ThemeDeletersEnumerator(players, themesCount); enumerator.Reset(false); var playerSets = new List <HashSet <int> >(); for (int i = 0; i < order.Length; i++) { Assert.IsTrue(enumerator.MoveNext()); Assert.AreEqual(enumerator.Current.PlayerIndex, order[i]); if (enumerator.Current.PlayerIndex == -1) { var found = false; for (int j = 0; j < playerSets.Count; j++) { if (playerSets[j].Intersect(enumerator.Current.PossibleIndicies).Any()) { found = true; Assert.AreEqual(playerSets[j], enumerator.Current.PossibleIndicies); } } if (!found) { playerSets.Add(enumerator.Current.PossibleIndicies); } } } Assert.IsFalse(enumerator.MoveNext()); enumerator.Reset(false); while (enumerator.MoveNext()) { if (enumerator.Current.PlayerIndex == -1) { var list = enumerator.Current.PossibleIndicies; var count = list.Count; var newIndex = list.First(); enumerator.Current.SetIndex(newIndex); Assert.AreEqual(enumerator.Current.PlayerIndex, newIndex); Assert.IsTrue(list.Count == count - 1); Assert.IsTrue(!list.Contains(newIndex)); } } }