public void GetStateAfterMoveForward_ShouldReturnCorrectNewState() { var originalState = new LawnMowerState(new Position(5, 10), Direction.East); var expectedNewState = new LawnMowerState(new Position(6, 10), Direction.East); var newState = originalState.GetStateAfterMoveForward(); newState .Should() .Be(expectedNewState); }
private LawnMowerState PerformCommand( LawnMowerState state, LawnMowerCommand command) { switch (command) { case LawnMowerCommand.TurnRight: return(state.GetStateAfterRightTurn()); case LawnMowerCommand.TurnLeft: return(state.GetStateAfterLeftTurn()); case LawnMowerCommand.MoveForward: return(state.GetStateAfterMoveForward()); default: throw new UnknownLawnMowerCommandException(); } }