public void MakeWrongAnswer_ShouldCall_GivePenaltyToCurrentPlayer_FromGamePlayers() { var gamePlayers = new GamePlayers(); gamePlayers.AddPlayer(new Player("A")); var wrongAnswerBehaviour = new WrongAnswerBehaviour(gamePlayers); Assert.AreEqual(false, gamePlayers.CurrentPlayerIsInPenalty); wrongAnswerBehaviour.MakeWrongAnswer(); Assert.AreEqual(true, gamePlayers.CurrentPlayerIsInPenalty); }
public void MakeCorrectAnswer_ShouldAddOnePointToPlayer_IfPlayerDidntHavePenalty() { var gamePlayers = new GamePlayers(); var player = new Player("A"); gamePlayers.AddPlayer(player); CorrectAnswerBehaviour correctAnswerBehaviour = new CorrectAnswerBehaviour(gamePlayers); correctAnswerBehaviour.MakeCorrectAnswer(); Assert.AreEqual(false, player.Penalty); Assert.AreEqual(1, gamePlayers.CurrentPlayerPoints); }
public void MakeCorrectAnswer_Should_Not_AddPointToPlayer_IfPlayerHavePenalty() { var gamePlayers = new GamePlayers(); var player = new Player("A"); gamePlayers.AddPlayer(player); CorrectAnswerBehaviour correctAnswerBehaviour = new CorrectAnswerBehaviour(gamePlayers); player.SetPenalty(); correctAnswerBehaviour.MakeCorrectAnswer(); Assert.AreEqual(true, player.Penalty); Assert.AreEqual(0, gamePlayers.CurrentPlayerPoints); }
public void GivenPlayerIsDidntHavePenalty_And_MakeRollAction_Should_AddRoll_ToPlayers_Place() { var gamePlayers = new GamePlayers(); var player = new Player("A"); gamePlayers.AddPlayer(player); GameQuestions gameQuestions = new GameQuestions(); RollBehaviour rollBehaviour = new RollBehaviour(gamePlayers, gameQuestions); Assert.AreEqual(0, player.Place); rollBehaviour.MakeRollAction(new Roll(2)); Assert.AreEqual(2, player.Place); }
public void GivenPlayerIsInPenaltyy_And_MakeRollAction_Should_Not_AddRoll_ToPlayers_Place_WhenPlayerMadeEvenRoll() { var gamePlayers = new GamePlayers(); var player = new Player("A"); gamePlayers.AddPlayer(player); GameQuestions gameQuestions = new GameQuestions(); RollBehaviour rollBehaviour = new RollBehaviour(gamePlayers, gameQuestions); player.SetPenalty(); Assert.AreEqual(0, player.Place); rollBehaviour.MakeRollAction(new Roll(2)); Assert.AreEqual(0, player.Place); }
public void GivenPlayerIsInPenalty_And_MakeRollAction_ShouldGiveLibertyWhenOddRollIsMade() { var gamePlayers = new GamePlayers(); var player = new Player("A"); gamePlayers.AddPlayer(player); GameQuestions gameQuestions = new GameQuestions(); RollBehaviour rollBehaviour = new RollBehaviour(gamePlayers, gameQuestions); player.SetPenalty(); Assert.AreEqual(false, player.Liberty); rollBehaviour.MakeRollAction(new Roll(3)); Assert.AreEqual(true, player.Liberty); }
public bool Add(Player player) { _gamePlayers.AddPlayer(player); LogPlayerAddition(player); return(true); }
public void GivenThereAre2Players_And_CurrentPlayer_ShouldReturnTheFirstPlayerAddedForTheFirstTime() { _gamePlayers.AddPlayer(new Player("A")); _gamePlayers.AddPlayer(new Player("B")); var expected = new Player("A").ToExpectedObject(); expected.ShouldMatch(_gamePlayers.CurrentPlayer); }