Exemple #1
0
        public Criteria(string path, IQueryCollection query)
        {
            Path           = path;
            Paginate       = PaginateExpression.Extract(query);
            Slice          = SliceExpression.Extract(query);
            FullTextSearch = FullTextSearchExpression <TIn> .Extract(query);

            Sort = OrderByExpression <TIn> .Extract(query);

            Filters = FilterCollectionExpression <TIn> .Extract(query);

            Operators = OperatorCollectionExpression <TIn> .Extract(query);

            Embeds = EmbedCollectionExpression <TIn> .Extract(query);
        }
        public void PaginateExpression_Page_1_With_Default_Limit()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_page", new StringValues("7") }
            };
            var query = new QueryCollection(values);



            //Act
            var paginate = PaginateExpression.Extract(query);
            var text     = paginate.ToString();

            //Assert
            text.Should().Be("_page=7&_limit=10");
        }
        public void PaginateExpression_Page_Empty()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_pages", new StringValues("7") }
            };
            var query = new QueryCollection(values);



            //Act
            var paginate = PaginateExpression.Extract(query);


            //Assert
            paginate.Should().BeNull();
        }