public void PlaceTokenOnBoard_throws_exception_when_spot_not_available_on_board() { //Arrange var board = new StandardTestBoard(); //Act board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.X, 1, 1); //Assert Assert.ThrowsException <InvalidOperationException>(() => board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 1, 1)); }
public void PlaceTokenOnBoard_puts_correct_token_in_spot_on_board() { //Arrange var board = new StandardTestBoard(); int column = 1; int row = 1; var token = TickTackToeBoard.TickTackToeToken.O; //Act board.PlaceTokenOnBoard(token, row, column); var valueAfterPlacement = board.GetValueAtLocation(row, column); //Assert Assert.AreEqual(token, valueAfterPlacement); }
public void GetValueAtLocation_returns_accurate_value() { //Arrange var board = new StandardTestBoard(); var token = TickTackToeBoard.TickTackToeToken.O; int expectedRow = 1; int expectedColumn = 2; board.PlaceTokenOnBoard(token, expectedRow, expectedColumn); //Act var value = board.GetValueAtLocation(expectedRow, expectedColumn); //Assert Assert.AreEqual(token, value); }
public void PlaceTokenOnBoard_puts_token_in_correct_spot_on_board() { //Arrange var board = new StandardTestBoard(); int column = 1; int row = 1; var valueBeforePlacement = board.GetValueAtLocation(row, column); //Act board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, row, column); var valueAfterPlacement = board.GetValueAtLocation(row, column); //Assert Assert.AreNotEqual(valueBeforePlacement, valueAfterPlacement); //TODO check to make sure no other elements in the array were changed (will need to use a fake/moq for this) }
public void PlaceTokenOnBoard_puts_token_in_available_spot_on_board() { //Arrange var board = new StandardTestBoard(); int column = 1; int row = 1; var valueBeforePlacement = board.GetValueAtLocation(row, column); //Act board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, row, column); var valueAfterPlacement = board.GetValueAtLocation(row, column); //Assert Assert.AreEqual(TickTackToeBoard.TickTackToeToken.Available, valueBeforePlacement); Assert.AreNotEqual(valueBeforePlacement, valueAfterPlacement); }
public void AnyMovesLeft_is_false_when_board_still_has_no_spaces_available() { //Arrange var board = new StandardTestBoard(); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.X, 0, 0); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.X, 0, 1); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.X, 0, 2); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 1, 0); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 1, 1); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 1, 2); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 2, 0); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 2, 1); board.PlaceTokenOnBoard(TickTackToeBoard.TickTackToeToken.O, 2, 2); //Act var result = board.AnyMovesLeft(); //Assert Assert.IsFalse(result); }