public async Task CanGetQuestionsList()
        {
            var authorizedClient = SystemTestExtension.GetTokenAuthorizeHttpClient(_factory);

            var getQuestionsListQuery = new GetQuestionsListQueryModel
            {
                Skip = 0,
                Take = 10
            };

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

            httpResponse.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
예제 #2
0
        public async Task <ActionResult <ResponseModel <QuestionsListModel> > > Get([FromQuery] GetQuestionsListQueryModel query)
        {
            try
            {
                var userId   = Claims[ClaimTypes.Sid].ToInt();
                var tenantId = Guid.Parse(Claims[ClaimTypes.UserData]);

                var questionsListModel = await Mediator.Send(new GetQuestionsListQuery(userId, tenantId, query.Skip, query.Take));

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