public void HandleQuery_ThrowsNotFoundExceptionForUnknownId() { var query = new GetCarDetailQuery { Id = 99 }; var handler = new GetCarDetailQueryHandler(_context, _mapper); Should.Throw <NotFoundException>(async() => { var result = await handler.Handle(query, CancellationToken.None); }); }
public async Task HandleQuery_ReturnCorrectVmAndData() { var query = new GetCarDetailQuery { Id = 1 }; var handler = new GetCarDetailQueryHandler(_context, _mapper); var result = await handler.Handle(query, CancellationToken.None); result.ShouldBeOfType <CarDetailVm>(); result.Type.ShouldBe("Skoda Octavia"); result.Color.ShouldBe("Silver"); result.NumberOfSeats.ShouldBe(5); }