public void ShouldInvokedNextAction() { //Arrange FakePlayerEndsGameAction nextAction = new FakePlayerEndsGameAction.Builder().Act(Bool.True).Build(); PlayerEndsGameAction subject = new PlayerEndsGameAction(nextAction); //Act subject.Act(null, null, null); //Assert nextAction.AssertActInvoked(); }
public void ShouldExecuteCommand() { //Arrange FakePlayerEndsGameAction fakePlayerEndsGameAction = new FakePlayerEndsGameAction.Builder().Act(Bool.True).Build(); PlayerTurnEndsGame subject = new PlayerTurnEndsGame(null, null, null, fakePlayerEndsGameAction); //Act bool actual = subject; //Assert fakePlayerEndsGameAction.AssertActInvoked(); }
public void ShouldReturnResultGivenNotGameOver() { //Arrange FakePlayerEndsGameAction fakePlayerEndsGameAction = new FakePlayerEndsGameAction.Builder().Act(Bool.True).Build(); GameOverGuardPlayerEndsGameAction subject = new GameOverGuardPlayerEndsGameAction(fakePlayerEndsGameAction); FakeGameState fakeGameState = new FakeGameState.Builder().IsGameOver(Bool.False).Build(); FakeBoard fakeBoard = new FakeBoard.Builder().GameState(fakeGameState).Build(); //Act bool actual = subject.Act(fakeBoard, null, null); //Assert actual.Should().BeTrue(); fakePlayerEndsGameAction.AssertActInvoked(); }
public void ShouldWinPrintActivePlayer() { //Arrange FakePlayerEndsGameAction fakePlayerEndsGameAction = new FakePlayerEndsGameAction.Builder().Act(Bool.True).Build(); TakeTurnPlayerEndsGameAction subject = new TakeTurnPlayerEndsGameAction(fakePlayerEndsGameAction); FakePlayer fakePlayer = new FakePlayer.Builder().TakeAction().Build(); //Act bool actual = subject.Act(null, fakePlayer, null); //Assert actual.Should().BeTrue(); fakePlayer.AssertTakeActionInvoked(); fakePlayerEndsGameAction.AssertActInvoked(); }
public void ShouldReturnResultGivenHasWinner() { //Arrange FakePlayerEndsGameAction fakePlayerEndsGameAction = new FakePlayerEndsGameAction.Builder().Act(Bool.True).Build(); PrintBoardPlayerEndsGameAction subject = new PrintBoardPlayerEndsGameAction(fakePlayerEndsGameAction); FakeBoard fakeBoard = new FakeBoard.Builder().Print().Build(); //Act bool actual = subject.Act(fakeBoard, null, null); //Assert actual.Should().BeTrue(); fakeBoard.AssertPrintInvoked(); fakePlayerEndsGameAction.AssertActInvoked(); }