public void CanDetectIfTheGameHasEnded() { var seeBoard = new SeeBoard(new AntidiagonalWinStub(0)); var response = seeBoard.Execute(); Assert.That(response.HasGameEnded, Is.True); }
public void CanDetectADiagonalWin(int pieceType) { var seeBoard = new SeeBoard(new DiagonalWinStub(pieceType)); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.EqualTo(pieceType)); }
public void GivenANewGame_WhenISeeTheBoard_ItMustBeEmpty() { var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual(new int?[3, 3], response.Board); Assert.That(response.Winner, Is.Null); }
public void CanDetectAVerticalWin2(int x) { var verticalWinStub = new VerticalWinStub(x, 1); var seeBoard = new SeeBoard(verticalWinStub); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.EqualTo(1)); }
public void TestInitialBoardState() { var boardGateway = new BoardReaderStub(); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual(new int?[3, 3], response.Board); }
public void CanDetectAHorizontalWin2(int y) { var horizontalWinStub = new HorizontalWinStub(y, 1); var seeBoard = new SeeBoard(horizontalWinStub); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.EqualTo(1)); }
public void CanDetectIfTheGameHasEndedWithATie() { var seeBoard = new SeeBoard(new TieStub()); var response = seeBoard.Execute(); Assert.That(response.HasGameEnded, Is.True); Assert.That(response.Winner, Is.Null); }
public void CanDetectIfTheGameHasNotEnded() { var boardGateway = new BoardReaderStub(); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.That(response.HasGameEnded, Is.False); }
public void TestFoo() { var boardGateway = new PieceInTheMiddleBoardReaderStub(); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual( new int?[, ] { { null, null, null }, { null, 1, null }, { null, null, null } }, response.Board ); }
public void CanDetectAWinForOAntiDiagonally() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(2, 0); placePiece.Execute(1, 0); placePiece.Execute(1, 1); placePiece.Execute(2, 1); placePiece.Execute(0, 2); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.EqualTo(0)); }
public void CanDetectAWinForOHorizontally() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(0, 0); placePiece.Execute(0, 1); placePiece.Execute(1, 0); placePiece.Execute(1, 1); placePiece.Execute(2, 0); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.Zero); }
public void GivenAGameWithOnePiecePlaced_WhenISeeTheBoard_ThenTheBoardIsUpdatedCorrectly() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(0, 0); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual( new int?[, ] { { 0, null, null }, { null, null, null }, { null, null, null } }, response.Board ); }
public void WhenANewPieceIsPlaced_MustBeDifferentFrom_ThePrevious() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(0, 0); placePiece.Execute(0, 1); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual( new int?[, ] { { 0, null, null }, { 1, null, null }, { null, null, null } }, response.Board ); }
public void CanNotOverwriteExistingPiece() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(0, 0); placePiece.Execute(0, 0); placePiece.Execute(0, 2); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.AreEqual( new int?[, ] { { 0, null, null }, { null, null, null }, { 1, null, null } }, response.Board ); }
public void GivenAllThePiecesArePlaced_AndThereIsNoWinner_CanDetectATie() { var placePiece = new PlacePiece(boardGateway, boardGateway); placePiece.Execute(0, 2); placePiece.Execute(1, 2); placePiece.Execute(2, 2); placePiece.Execute(1, 1); placePiece.Execute(0, 1); placePiece.Execute(0, 0); placePiece.Execute(1, 0); placePiece.Execute(2, 0); placePiece.Execute(2, 1); var seeBoard = new SeeBoard(boardGateway); var response = seeBoard.Execute(); Assert.That(response.Winner, Is.Null); Assert.That(response.HasGameEnded, Is.True); }