示例#1
0
        public async Task GetSummaryOfAdministeredPlantNutrientsReturnsSummaryAndCorrectContentType()
        {
            // Given
            DateTime fromDate = new DateTime(2018, 12, 01, 00, 00, 00);
            DateTime toDate   = new DateTime(2018, 12, 31, 23, 59, 59);

            A.CallTo(() => _fakeQuery.Summary(A <Guid> .Ignored, fromDate, toDate))
            .Returns(A.Fake <IEnumerable <PlantNutrientAdministrationSummaryModel> >());

            // When
            HttpResponseMessage response = await Client.GetAsync(EndPointFactory.NutrientsSummaryWithinDateRangeEndpoint());

            // Then
            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Content.Headers.ContentType.ToString().Should().Be("application/json; charset=utf-8");
            A.CallTo(() => _fakeQuery.Summary(A <Guid> .Ignored, fromDate, toDate))
            .MustHaveHappenedOnceExactly();
        }