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"); }
public async Task <ActionResult <CarDto> > GetAll([FromQuery] GetCarsListQuery query) { return(Ok(await _mediator.Send(query))); }