public void RRBResetMatchScore_FiresMatchesModifiedEvent_WithOnlyOneMatch()
        {
            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 + 1);
                pList.Add(moq.Object);
            }
            IBracket b = new RoundRobinBracket(pList);

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

            int affectedMatches = 0;

            b.MatchesModified += delegate(object sender, BracketEventArgs e)
            {
                affectedMatches += e.UpdatedMatches.Count;
            };

            b.ResetMatchScore(1);
            Assert.AreEqual(1, affectedMatches);
        }
        public void RRBResetScore_ThrowsNotFound_WithBadInput()
        {
            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 RoundRobinBracket(pList);

            b.ResetMatchScore(b.NumberOfMatches + 1);
            Assert.AreEqual(1, 2);
        }
        public void RRBResetScore_RemovesRankingsWin_FromManualMatchWinner()
        {
            List <IPlayer> pList = new List <IPlayer>();

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

            b.AddGame(1, 1, 4, PlayerSlot.Challenger);
            b.SetMatchWinner(1, PlayerSlot.Challenger);
            b.ResetMatchScore(1);
            Assert.AreEqual(0, b.Rankings[0].Wins);
        }