Ejemplo n.º 1
0
        public void when_given_two_parking_area_should_return_the_parking_one()
        {
            var parkingAreaOne = new ParkingArea("Parking Area One", 100);
            var parkingAreaTwo = new ParkingArea("Parking Area Two", 1000);

            Assert.Equal("Parking Area One", parkingAreaOne.WhichIsNear(parkingAreaTwo));
        }
Ejemplo n.º 2
0
 public string WhichIsNear(ParkingArea parkingAreaTwo)
 {
     if (_unit == parkingAreaTwo._unit)
     {
         return(_distance < parkingAreaTwo._distance ? _parkingAreaName : parkingAreaTwo._parkingAreaName);
     }
     if (_unit == "Km")
     {
         _distance *= 1000;
     }
     else
     {
         parkingAreaTwo._distance *= 1000;
     }
     return(_distance < parkingAreaTwo._distance ? _parkingAreaName : parkingAreaTwo._parkingAreaName);
 }