public void SwissReplacePlayer_ReplacesPlayerIDinByesList() { List <IPlayer> pList = new List <IPlayer>(); for (int i = 0; i < 7; ++i) { Mock <IPlayer> moq = new Mock <IPlayer>(); moq.Setup(p => p.Id).Returns(i + 1); pList.Add(moq.Object); } IBracket b = new SwissBracket(pList); int pId = 50; Mock <IPlayer> player = new Mock <IPlayer>(); player.Setup(p => p.Id).Returns(pId); b.ReplacePlayer(player.Object, 0); // 0-index had a first-round bye. List <IMatch> round1 = b.GetRound(1); foreach (IMatch match in round1) { b.SetMatchWinner(match.MatchNumber, PlayerSlot.Defender); } // Second round is now populated. // If new player was correctly added to the Byes list... // He will be in exactly 1 second-round match: List <IMatch> round2 = b.GetRound(2); Assert.AreEqual(1, round2.Where(m => m.Players.Select(p => p.Id).Contains(pId)).ToList().Count); }