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

            var getSessionsListQuery = new GetSessionsListQueryModel
            {
                Skip = 0,
                Take = 10
            };

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

            httpResponse.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
Exemplo n.º 2
0
        public async Task <ActionResult <ResponseModel <SessionsListModel> > > Get([FromQuery] GetSessionsListQueryModel query)
        {
            try
            {
                var tenantId = Guid.Parse(Claims[ClaimTypes.UserData]);

                var sessionsListModel = await Mediator.Send(new GetSessionsListQuery(tenantId, query.Skip, query.Take));

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