示例#1
0
        public async Task GetListReturnsFieldsAndCorrectContentType()
        {
            // Given
            A.CallTo(() => _fakeQuery.GetAll()).Returns(A.Fake <IEnumerable <Field> >());

            // 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();
        }
示例#2
0
        public async Task <ActionResult <IEnumerable <FieldIndexViewModel> > > Get()
        {
            IEnumerable <Field> fields = await _queries.GetAll();

            return(Ok(_mapper.Map <IEnumerable <FieldIndexViewModel> >(fields)));
        }