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); }
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); }
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)); }