Ejemplo n.º 1
0
        public async Task GetListReturnsNutrientsAndCorrectContentType()
        {
            // Given
            A.CallTo(() => _fakeQuery.GetAll()).Returns(A.Fake <IEnumerable <Nutrient> >());

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

            // Then
            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Content.Headers.ContentType.ToString().Should().Be("application/json; charset=utf-8");
            A.CallTo(() => _fakeQuery.GetAll()).MustHaveHappenedOnceExactly();
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <NutrientIndexViewModel> > > Get()
        {
            IEnumerable <Nutrient> nutrients = await _queries.GetAll();

            return(Ok(_mapper.Map <IEnumerable <NutrientIndexViewModel> >(nutrients)));
        }