示例#1
0
        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();
        }
示例#2
0
        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)));
        }