コード例 #1
0
        public void RemovePlayer_ThrowsNotFound_IfPlayerIsntPresent()
        {
            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 SingleElimBracket(pList);

            b.RemovePlayer(-5);

            Assert.AreEqual(1, 2);
        }
コード例 #2
0
        public void RemovePlayer_ClearsBracketMatches()
        {
            IPlayer        ip    = new Mock <IPlayer>().Object;
            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 SingleElimBracket(pList);

            b.AddPlayer(ip);
            b.CreateBracket();
            b.RemovePlayer(ip.Id);

            Assert.AreEqual(0, b.NumberOfMatches);
        }
コード例 #3
0
        public void RemovePlayer_Removes()
        {
            var ip = new Mock <IPlayer>();

            ip.Setup(p => p.Id).Returns(10);
            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 SingleElimBracket(pList);

            b.AddPlayer(ip.Object);
            b.RemovePlayer(ip.Object.Id);

            Assert.IsFalse(b.Players.Contains(ip.Object));
        }