public MarsRover(IPosition roverPosition, IPlateau roverPlateau, RoverState currentState) { if (roverPlateau == null) { throw new ArgumentNullException("roverPlateau", "Rover Plateau is a required parameter and it cannot be null"); } if (currentState == null) { throw new ArgumentNullException("currentState", "Current State is a required parameter and it cannot be null"); } _roverPlateau = roverPlateau; if(!_roverPlateau.ValidCoordinate(Coordinate.CreateNew(roverPosition.Xaxis,roverPosition.Yaxis))) { throw new ArgumentOutOfRangeException("roverPosition", "Rover coordinates are out of the range"); } if (roverPosition.Direction == Enum_Direction.Direction_Error) { throw new ArgumentException("roverPosition", "Rover is set to error direction"); } _roverPosition = roverPosition; _currentState = currentState; }
public void SetCurrentState(RoverState roverState) { _currentState = roverState; }