public void GSLAddGame_CorrectlyAddsGamesToAllRemainingMatches()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 1; i <= 8; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new GSLGroups(pList, 2);

            for (int n = 1; n <= b.NumberOfMatches; ++n)
            {
                b.AddGame(n, 1, 0, PlayerSlot.Defender);
            }
            Assert.AreEqual(b.NumberOfPlayers(), b.Rankings.Count);
        }
        public void GSLAddGame_SetsGroupStageAsFinishedWhenAllMatchesAreDone()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 1; i <= 8; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new GSLGroups(pList, 2);

            for (int n = 1; n <= b.NumberOfMatches; ++n)
            {
                b.AddGame(n, 1, 0, PlayerSlot.Defender);
            }
            Assert.IsTrue(b.IsFinished);
        }
        public void GSLAddGame_DoesNotTryToAdvancePlayersToGrandFinal()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 1; i <= 8; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new GSLGroups(pList, 2);

            for (int n = 1; n <= 3; ++n)
            {
                b.AddGame(n, 1, 0, PlayerSlot.Defender);
            }
            Assert.AreEqual(PlayerSlot.Defender, b.GetMatch(3).WinnerSlot);
        }
        public void GSLAddGame_HasOneFirstPlaceRankerForEachGroup()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 1; i <= 8; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new GSLGroups(pList, 2);

            for (int n = 1; n <= b.NumberOfMatches; ++n)
            {
                b.AddGame(n, 1, 0, PlayerSlot.Defender);
            }
            Assert.AreEqual((b as IGroupStage).NumberOfGroups,
                            b.Rankings.Where(r => r.Rank == 1).ToList().Count);
        }