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(); }
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))); }