Example #1
0
        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++;
            }
        }
Example #2
0
        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++;
            }
        }
Example #3
0
        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++;
            }
        }