Esempio n. 1
0
        public async Task Should_get_parkingLots_when_give_pageIndex_Test()
        {
            var scope                       = Factory.Services.CreateScope();
            var scopeServices               = scope.ServiceProvider;
            ParkingLotDbContext context     = scopeServices.GetRequiredService <ParkingLotDbContext>();
            ParkingLotDto       parkingLot1 = new ParkingLotDto();

            parkingLot1.Name     = "345";
            parkingLot1.Capacity = 0;
            parkingLot1.Location = "southRoad";

            ParkingLotService parkingLotService = new ParkingLotService(context);
            var name1 = await parkingLotService.AddParkingLot(parkingLot1);

            var actualParkingLots = await parkingLotService.GetParkingLotByPageIndex(2);

            Assert.Equal(new List <ParkingLotDto>(), actualParkingLots);
        }
Esempio n. 2
0
        public async Task <ActionResult <List <ParkingLotDto> > > GetParkingLots([FromQuery] int pageIndex)
        {
            var parkingLots = await parkingLotService.GetParkingLotByPageIndex(pageIndex);

            return(Ok(parkingLots));
        }