public void ReplacePlayer_ThrowsInvalidIndex_WithBadIndexParam() { 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.ReplacePlayer(new Mock <IPlayer>().Object, 6); Assert.AreEqual(1, 2); }
public void ReplacePlayer_ThrowsArgNullExcept_OnNullParam() { 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.ReplacePlayer(null, 2); Assert.AreEqual(1, 2); }
public void ReplacePlayer_Replaces() { 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); int pIndex = 2; b.ReplacePlayer(ip, pIndex); Assert.AreEqual(ip, b.Players[pIndex]); }