public async Task WhenDoesNotExist_ThrowNotFoundException() { var request = new GetApartmentQuery() { Id = -1 }; await Assert .ThrowsAsync <NotFoundException>(async() => await this.sut.Handle(request, CancellationToken.None).ConfigureAwait(false)) .ConfigureAwait(false); }
public async Task WhenExists_ReturnsApartmentWithRequestedId() { var request = new GetApartmentQuery() { Id = this.dbApartment.Id }; var result = await this.sut.Handle(request, CancellationToken.None).ConfigureAwait(false); Assert.NotNull(result); Assert.Equal(this.dbApartment.Id, result.Id); }