Esempio n. 1
0
        public async Task HandleQuery_ReturnsCorrectVmAndCount()
        {
            var query   = new GetCarsListQuery();
            var handler = new GetCarsListQueryHandler(_context, _mapper);

            var result = await handler.Handle(query, CancellationToken.None);

            result.ShouldBeOfType <CarsListVm>();
            result.Cars.Count.ShouldBe(2);

            var car = result.Cars.First();

            car.Type.ShouldBe("Skoda Octavia");
        }
Esempio n. 2
0
 public async Task <ActionResult <CarDto> > GetAll([FromQuery] GetCarsListQuery query)
 {
     return(Ok(await _mediator.Send(query)));
 }