public void IsPositionWithinLawn_ShouldReturnTrueWhenPositionIsWithin( int positionX, int positionY) { var lawnSize = new LawnSize(5, 10); var position = new Position(positionX, positionY); lawnSize .IsPositionWithinLawn(position) .Should() .BeTrue(); }
private IEnumerable<LawnMowerState> SimulateMovementImpl( LawnMowerState initialState, LawnSize lawnSize, IEnumerable<LawnMowerCommand> commands) { var currentState = initialState; foreach (var command in commands) { currentState = PerformCommand(currentState, command); if (!lawnSize.IsPositionWithinLawn(currentState.Position)) { throw new CannotMoveOutsideLawnBoundariesException(); } yield return currentState; } }