Exemplo n.º 1
0
        public async Task <ActionResult <ParkingOrderDto> > GetParkingOrderByOrderNumber(string orderNumber)
        {
            var foundParkingOrder = await parkingOrderService.GetParkingOrderByOrderNumber(orderNumber);

            if (foundParkingOrder != null)
            {
                return(Ok(foundParkingOrder));
            }

            return(NotFound());
        }
Exemplo n.º 2
0
        public async Task Should_get_correct_parkingOrder_when_get_parkingOrder_via_parkingOrderService()
        {
            // given
            var scope                               = Factory.Services.CreateScope();
            var scopedServices                      = scope.ServiceProvider;
            ParkingLotContext   context             = scopedServices.GetRequiredService <ParkingLotContext>();
            ParkingOrderService parkingOrderService = new ParkingOrderService(context);
            var parkingOrderDtoList                 = GenerateParkingOrderDtoList();

            foreach (var parkingOrderDto in parkingOrderDtoList)
            {
                await parkingOrderService.AddParkingOrder(parkingOrderDto);
            }

            // when
            var parkingOrder = await parkingOrderService.GetParkingOrderByOrderNumber(parkingOrderDtoList[0].OrderNumber);

            // then
            Assert.Equal(parkingOrderDtoList[0], parkingOrder);
        }