public void GetAllDocuments()
        {
            var response = docProcessor.GetDocuments(new DocumentQuery());

            Assert.NotNull(response);
            Assert.Equal(1, response.Page);
            Assert.Equal(10, response.PageSize);
            Assert.True(response.Total > 0);
            Assert.True(response.TotalPages > 0);
            Assert.NotEmpty(response.Results);
        }
Exemplo n.º 2
0
        public IActionResult Get(
            [FromQuery] string templateName,
            [FromQuery] string templateVersion,
            [FromQuery] string mappingName,
            [FromQuery] string mappingVersion,
            [FromQuery][DefaultValue(1)] int?page,
            [FromQuery][DefaultValue(10)] int?pageSize,
            [FromQuery] string orderBy,
            [FromQuery][DefaultValue(false)] bool?descending
            )
        {
            var criteria = new DocumentQuery()
            {
                TemplateName    = templateName,
                TemplateVersion = templateVersion,
                MappingsName    = mappingName,
                MappingsVersion = mappingVersion,
                Page            = page ?? 1,
                PageSize        = pageSize ?? 10,
                OrderBy         = orderBy,
                Descending      = descending ?? false,
            };
            var documents = processor.GetDocuments(criteria);

            return(Ok(documents));
        }
        public IActionResult GetTemplateVersionMappingVersionDocuments([FromRoute] string templateName,
                                                                       [FromRoute] string templateVersion,
                                                                       [FromRoute] string mappingName,
                                                                       [FromRoute] string mappingVersion,
                                                                       [FromQuery] PagingParams pagingParams)
        {
            pagingParams ??= new PagingParams();
            var query = new DocumentQuery()
            {
                TemplateName    = templateName,
                TemplateVersion = templateVersion,
                MappingsName    = mappingName,
                MappingsVersion = mappingVersion,
                Page            = pagingParams.Page,
                PageSize        = pagingParams.PageSize,
                OrderBy         = pagingParams.OrderBy,
                Descending      = pagingParams.Descending,
            };

            return(Ok(processor.GetDocuments(query)));
        }