public void GameClosedByShouldReturnSecondPlayerWhenTheSecondPlayerIsGameCloser() { var firstRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var secondRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object) { GameCloser = true }; var roundResult = new RoundResult(firstRoundPlayerInfo, secondRoundPlayerInfo); Assert.AreEqual(PlayerPosition.SecondPlayer, roundResult.GameClosedBy); }
public void GameClosedByShouldReturnNoOnePlayerWhenNoneOfThePlayersIsGameCloser() { var firstRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var secondRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var roundResult = new RoundResult(firstRoundPlayerInfo, secondRoundPlayerInfo); Assert.AreEqual(PlayerPosition.NoOne, roundResult.GameClosedBy); }
public void ConstructorShouldSetProperties() { var firstRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var secondRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var roundResult = new RoundResult(firstRoundPlayerInfo, secondRoundPlayerInfo); Assert.AreEqual(firstRoundPlayerInfo, roundResult.FirstPlayer); Assert.AreEqual(secondRoundPlayerInfo, roundResult.SecondPlayer); }
public void NoTricksPlayerShouldReturnSecondPlayerWhenOnlyFirstPlayerHasTricks() { var firstRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var secondRoundPlayerInfo = new RoundPlayerInfo(new Mock<IPlayer>().Object); var roundResult = new RoundResult(firstRoundPlayerInfo, secondRoundPlayerInfo); firstRoundPlayerInfo.TrickCards.Add(new Card(CardSuit.Club, CardType.Ace)); Assert.AreEqual(PlayerPosition.SecondPlayer, roundResult.NoTricksPlayer); }
private void UpdatePoints(RoundResult roundResult) { IRoundWinnerPointsLogic roundWinnerPointsPointsLogic = new RoundWinnerPointsPointsLogic(); var roundWinnerPoints = roundWinnerPointsPointsLogic.GetWinnerPoints( roundResult.FirstPlayer.RoundPoints, roundResult.SecondPlayer.RoundPoints, roundResult.GameClosedBy, roundResult.NoTricksPlayer, this.gameRules); switch (roundWinnerPoints.Winner) { case PlayerPosition.FirstPlayer: this.FirstPlayerTotalPoints += roundWinnerPoints.Points; this.firstToPlay = PlayerPosition.SecondPlayer; break; case PlayerPosition.SecondPlayer: this.SecondPlayerTotalPoints += roundWinnerPoints.Points; this.firstToPlay = PlayerPosition.FirstPlayer; break; } }