public bool TransferToNextRound(RoundBase currentRound) { bool roundHasFinished = currentRound.GetPlayState() == PlayStateEnum.Finished; if (roundHasFinished) { RoundBase nextRound = currentRound.GetNextRound(); bool hasRoundToTransferTo = nextRound != null; if (hasRoundToTransferTo) { PlayerReferences = currentRound.GetAdvancingPlayerReferences(); bool hasPlayerReferencesToTransfer = PlayerReferences.Count > 0; if (hasPlayerReferencesToTransfer) { nextRound.ReceiveTransferedPlayerReferences(this); return(true); } // LOG Error: Tried to transfer advancing player references to next round without any player references. return(false); } // LOG Error: Tried to transfer advancing player references to nonexistent next round. return(false); } // LOG Error: Tried to transfer advancing player references to next round before current round is finished. return(false); }
public static void FetchingAdvancingPlayersInRoundYieldsGivenPlayerNames(RoundBase round, List <string> playerNames) { List <PlayerReference> playerReferences = round.GetAdvancingPlayerReferences(); playerReferences.Should().HaveCount(playerNames.Count); foreach (string playerName in playerNames) { playerReferences.SingleOrDefault(playerReference => playerReference.Name == playerName).Should().NotBeNull(); } }
public static void FetchingAdvancingPlayersInRoundYieldsNull(RoundBase round) { round.GetAdvancingPlayerReferences().Should().BeNull(); }