public void LawnPlaceLawnMower_PassedLawnMowerWithXAndYAlreadyOccupied_ThrowsMowerPositionOccupiedException() { //Arrange ILawn lawn = new Lawn(5, 5); var mower1 = new LawnMower(0, 0, CompassDirection.N, ref lawn); //Act //Assert Assert.Throws<Lawn.LawnMowerPositionOccupiedException>(() => new LawnMower(0, 0, CompassDirection.N, ref lawn)); }
public void LawnPlaceMower_PassedLawnMowerWithXOrYOutOfRange_ThrowsIndexOutOfRangeException() { //Arrange ILawn lawn = new Lawn(5, 5); var lawnMower = new LawnMower(1, 2, CompassDirection.N, ref lawn); //Act //Assert Assert.Throws<IndexOutOfRangeException>(() => lawn.PlaceLawnMower(lawnMower, 6, 6)); }
public List<Tuple<ILawnMower, string>> MowersWithMovementInstructions { get; } //string repsresents MovementInstructions public void AddLawnMower(int x, int y, CompassDirection initialHeading, string movementInstructions) { var lawnMower = new LawnMower(x, y, initialHeading, ref _lawn); MowersWithMovementInstructions.Add(new Tuple<ILawnMower, string>(lawnMower, movementInstructions)); }
public void PlaceLawnMower(LawnMower lawnMower, int x, int y) { if(null != LawnMowerPostions[x, y]) throw new LawnMowerPositionOccupiedException("There is laready a mower at this position"); LawnMowerPostions[x, y] = lawnMower; }