public async Task GetSummaryOfPlantEventReturnsNotFoundAndCorrectContentTypeIfResourceNotFoundExceptionOccured() { // Given A.CallTo(() => _fakeQuery.Summary(A <Guid> .Ignored, A <DateTime?> .Ignored, A <DateTime?> .Ignored)) .Returns(Task.FromResult <IEnumerable <SpeciesNutritionSummaryModel> >(null)); // When HttpResponseMessage response = await Client.GetAsync(EndPointFactory.SpeciesSummaryEndpoint()); // Then response.StatusCode.Should().Be(HttpStatusCode.NotFound); response.Content.Headers.ContentType.ToString().Should().Be("application/problem+json; charset=utf-8"); A.CallTo(() => _fakeQuery.Summary(A <Guid> .Ignored, A <DateTime?> .Ignored, A <DateTime?> .Ignored)) .MustHaveHappenedOnceExactly(); }
public async Task <ActionResult <IEnumerable <SpeciesNutritionSummaryViewModel> > > GetSummary(Guid id, [FromQuery] DateTime?fromDate = null, [FromQuery] DateTime?toDate = null) { IEnumerable <SpeciesNutritionSummaryModel> nutritionSummary = await _queries.Summary(id, fromDate, toDate); if (nutritionSummary is null) { return(NotFound()); } return(Ok(_mapper.Map <IEnumerable <SpeciesNutritionSummaryViewModel> >(nutritionSummary))); }