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

            for (int i = 0; i < 16; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new DoubleElimBracket(pList);

            b.SetMaxGamesForWholeLowerRound(1, -1);
            Assert.AreEqual(1, 2);
        }
        public void DEBSMGFWLR_DoesNotUpdateUpperBracketRound()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 0; i < 16; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new DoubleElimBracket(pList);

            int round = 2;

            b.SetMaxGamesForWholeLowerRound(round, 5);
            Assert.AreEqual(1, b.GetRound(round)[0].MaxGames);
        }
        public void DEBSMGFWLR_ThrowsInactiveMatch_WhenMatchIsFinished()
        {
            List <IPlayer> pList = new List <IPlayer>();

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

            for (int n = 1; n < b.NumberOfMatches; ++n)
            {
                b.AddGame(n, 1, 0, PlayerSlot.Defender);
            }

            b.SetMaxGamesForWholeLowerRound(1, 3);
            Assert.AreEqual(1, 2);
        }
        public void DEBRemoveLastGame_RemovesFromLowerBracket()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 0; i < 4; ++i)
            {
                Mock <IPlayer> moq = new Mock <IPlayer>();
                moq.Setup(p => p.Id).Returns(i);
                pList.Add(moq.Object);
            }
            IBracket b = new DoubleElimBracket(pList);

            b.AddGame(1, 1, 0, PlayerSlot.Defender);
            b.AddGame(2, 1, 0, PlayerSlot.Defender);
            b.SetMaxGamesForWholeLowerRound(1, 3);
            int mNum = b.GetLowerRound(1)[0].MatchNumber;

            b.AddGame(mNum, 1, 0, PlayerSlot.Defender);

            b.RemoveLastGame(mNum);
            Assert.AreEqual(0, b.GetMatch(mNum).Score[(int)PlayerSlot.Defender]);
        }