コード例 #1
0
        public void DEBResetMatches_FiresMatchesModifiedEvent_WithAllAffectedMatches()
        {
            List <IPlayer> pList = new List <IPlayer>();

            for (int i = 0; i < 17; ++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.SetMatchWinner(n, PlayerSlot.Defender);
            }

            int matchesAffected = -1;

            b.MatchesModified += delegate(object sender, BracketEventArgs e)
            {
                matchesAffected = e.UpdatedMatches
                                  .Select(mm => mm.MatchNumber).Distinct().ToList().Count;
            };
            b.ResetMatches();
            Assert.AreEqual(b.NumberOfMatches, matchesAffected);
        }