public async Task GetSpeciesReturnsNotFoundAndCorrectContentType() { // Given A.CallTo(() => _fakeQuery.Get(A <Guid> .Ignored)).Returns(Task.FromResult <Domain.Species>(null)); // When HttpResponseMessage response = await Client.GetAsync(EndPointFactory.DetailsEndpoint()); // Then response.StatusCode.Should().Be(HttpStatusCode.NotFound); response.Content.Headers.ContentType.ToString().Should().Be("application/problem+json; charset=utf-8"); A.CallTo(() => _fakeQuery.Get(A <Guid> .Ignored)).MustHaveHappenedOnceExactly(); }
public async Task <ActionResult <SpeciesDetailsViewModel> > GetSpecies(Guid id) { Species species = await _queries.Get(id); if (species is null) { return(NotFound()); } return(Ok(_mapper.Map <SpeciesDetailsViewModel>(species))); }