public void IsValidMove_WhenMoveExceedsBoard_ReturnsFalse(int size, int row, int column) { bool actual = systemUnderTest.IsValidMove(new Move(Player.X, row, column), GameState.NewGameXMove, new GameBoardMark[size, size]); Assert.IsFalse(actual); }
public void MakeMove_WhenInvoked_MakesMove() { InvokeMakeMove(); Received.InOrder(() => { moveValidatorMock.IsValidMove(move, Arg.Any <GameState>(), board); gameBoardMock.PlaceMarker(move); gameBoardAnalyzerMock.AnalyzeGameBoard(board); }); }
/// <summary> /// Handle chess piece move if valid /// </summary> /// <param name="newX">X coordinate to move to</param> /// <param name="newY">Y coordinate to move to</param> /// <remarks> /// Would ideally have separate unit tests for this but code is covered in current PawnTests /// </remarks> public void Move(int newX, int newY) { if (_validator.IsValidMove(newX, newY)) { _chessPiece.XCoordinate = newX; _chessPiece.YCoordinate = newY; } }
public bool MakeMove(Move move) { if (!moveValidator.IsValidMove(move, GameState, GameBoard)) { return(false); } gameBoard.PlaceMarker(move); GameBoardState gameBoardState = gameBoardAnalyzer.AnalyzeGameBoard(GameBoard); UpdateGameState(gameBoardState); return(true); }