Esempio n. 1
0
        public async Task CanGetAvatarsList()
        {
            var authorizedClient = SystemTestExtension.GetTokenAuthorizeHttpClient(_factory);

            var getAvatarsListQuery = new GetAvatarsListQueryModel
            {
                Skip = 0,
                Take = 10
            };

            var httpResponse = await authorizedClient.GetAsync(
                requestUri : $"/Avatar?Skip={getAvatarsListQuery.Skip}&Take={getAvatarsListQuery.Take}");

            httpResponse.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
Esempio n. 2
0
        public async Task <ActionResult <ResponseModel <AvatarsListModel> > > Get([FromQuery] GetAvatarsListQueryModel query)
        {
            try
            {
                var avatarsListModel = await Mediator.Send(new GetAvatarsListQuery(query.Skip, query.Take));

                return(Ok(avatarsListModel));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch
            {
                return(StatusCode(HttpStatusCode.InternalServerError.ToInt()));
            }
        }