예제 #1
0
        public async Task GetFieldReturnsNotFoundAndCorrectContentType()
        {
            // Given
            A.CallTo(() => _fakeQuery.Get(A <Guid> .Ignored)).Returns(Task.FromResult <Field>(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 <FieldDetailsViewModel> > GetField(Guid id)
        {
            Field field = await _queries.Get(id);

            if (field is null)
            {
                return(NotFound());
            }

            return(Ok(_mapper.Map <FieldDetailsViewModel>(field)));
        }