public async Task Story1_AC5_Should_update_parkingLot_capacity()
        {
            // given
            var parkingLot  = new ParkingLot("Lot1", 10, "location1");
            var updateModel = new ParkingLotUpdateModel(20);

            // when
            var name = await service.AddParkingLot(parkingLot);

            await service.UpdateParkingLot(name, updateModel);

            var lot = await service.GetParkingLotByName(name);

            // then
            Assert.Equal(updateModel.Capacity, lot.Capacity);
        }
        public async Task Should_update_parkingLot_Successfully_Via_Service()
        {
            var scope          = Factory.Services.CreateScope();
            var scopedServices = scope.ServiceProvider;

            ParkingLotDbContext context           = scopedServices.GetRequiredService <ParkingLotDbContext>();
            ParkingLotService   parkingLotService = new ParkingLotService(context);

            context.ParkingLots.RemoveRange(context.ParkingLots);
            context.SaveChanges();
            var update    = new UpdateParkingLotDto(50);
            var addReturn = await parkingLotService.AddParkingLot(parkingLotDto1);

            var updateReturn = await parkingLotService.UpdateParkingLot(addReturn, update);

            Assert.Equal(50, updateReturn.Capacity);
        }
        public async Task <IActionResult> Patch(string name, ParkingLotUpdateModel data)
        {
            var lotFound = await service.GetParkingLotByName(name);

            if (lotFound == null)
            {
                return(NotFound("no lot match name"));
            }

            if (data.Capacity < 0)
            {
                return(BadRequest("capacity can not be negative"));
            }

            await service.UpdateParkingLot(name, data);

            return(NoContent());
        }