Ejemplo n.º 1
0
        public async void ListVehicles(
            EStatusCode expectedStatus,
            ListVehicles query
            )
        {
            var vehicle = EntitiesFactory.NewVehicle(
                brandId: query.BrandId,
                modelId: query.ModelId,
                fuel: query.FuelId,
                color: query.ColorId
                ).Save();

            var(status, result) = await Request.Get <QueryResultListTest <VechicleList> >(Uri, query);

            Assert.Equal(expectedStatus, status);
            if (expectedStatus == EStatusCode.Success)
            {
                Assert.NotNull(result.Data);
                var vehicleResult = result.Data.FirstOrDefault(v => v.Id == vehicle.Id);
                Assert.NotNull(vehicleResult);
                Assert.Equal(vehicle.Year, vehicleResult.Year);
                Assert.Equal(vehicle.Model.Brand.Name, vehicleResult.BrandName);
                Assert.Equal(vehicle.Model.Name, vehicleResult.ModelName);
                Assert.NotNull(vehicleResult.ColorHex);
                Assert.NotNull(vehicleResult.ColorName);
                Assert.NotNull(vehicleResult.FuelName);
            }
        }
Ejemplo n.º 2
0
 public async Task <ActionResult <QueryResultList <VechicleList> > > ListAsync([FromQuery] ListVehicles query)
 {
     return(GetResult(await _queriesHanlder.Handle(query)));
 }