public async Task CanGetProfessionsList()
        {
            var client = SystemTestExtension.GetTokenAuthorizeHttpClient(_factory);

            var query = new GetProfessionsListQueryModel
            {
                Skip = 0,
                Take = 10
            };

            //Get professions request
            var httpResponse = await client.GetAsync(requestUri : $"/Profession?Skip={query.Skip}&Take={query.Take}");

            httpResponse.EnsureSuccessStatusCode();

            Assert.True(httpResponse.IsSuccessStatusCode);
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
示例#2
0
        public async Task <ActionResult <ResponseModel <ProfessionsListModel> > > Get([FromQuery] GetProfessionsListQueryModel query)
        {
            try
            {
                var tenantId = Guid.Parse(Claims[ClaimTypes.UserData]);

                var professionsListModel = await Mediator.Send(new GetProfessionsListQuery(tenantId, query.Skip, query.Take));

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