public void GetStateAfterRightTurn_ShouldReturnCorrectNewState() { var originalState = new LawnMowerState(new Position(5, 10), Direction.East); var expectedNewState = new LawnMowerState(new Position(5, 10), Direction.South); var newState = originalState.GetStateAfterRightTurn(); 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(); } }