public void TestListMatches_WithLoop() { var straightOrderEnumerable = BaseBattingOrderEnumerable.GetBattingOrder(BattingOrderType.StraightOrder, _players, false); var index = 0; var loopIndex = 0; var maxLoopIndex = 2; foreach (var enumerablePlayer in straightOrderEnumerable) { if (index == _players.Count) { if (loopIndex == maxLoopIndex) { break; } index = 0; loopIndex++; } Assert.AreEqual(enumerablePlayer.Name, _players[index].Name); Assert.AreEqual(enumerablePlayer.Gender, _players[index].Gender); index++; } }
public void TestListMatches_WithLoop() { var alternatingOrderEnumerable = BaseBattingOrderEnumerable.GetBattingOrder(BattingOrderType.AlternatingGender, _players); var index = 0; var loopIndex = 0; var maxLoopIndex = 2; Gender?currentGender = null; foreach (var enumerablePlayer in alternatingOrderEnumerable) { if (index == _players.Count) { if (loopIndex == maxLoopIndex) { break; } index = 0; loopIndex++; } if (currentGender == null) { // First gender is randomly assigned currentGender = enumerablePlayer.Gender; } else { currentGender = currentGender == Gender.Male ? Gender.Female : Gender.Male; } Assert.AreEqual(enumerablePlayer.Gender, currentGender); index++; } }
public void TestListMatches() { var straightOrderEnumerable = BaseBattingOrderEnumerable.GetBattingOrder(BattingOrderType.StraightOrder, _players, false); var index = 0; var stoppingPoint = _players.Count; foreach (var enumerablePlayer in straightOrderEnumerable) { if (index == stoppingPoint) { break; } Assert.AreEqual(enumerablePlayer.Name, _players[index].Name); Assert.AreEqual(enumerablePlayer.Gender, _players[index].Gender); index++; } }