示例#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 SliceExpression_Slice_Empty()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_start", new StringValues("A") }
            };
            var query = new QueryCollection(values);



            //Act
            var slice = SliceExpression.Extract(query);



            //Assert
            slice.Should().BeNull();
        }
        public void SliceExpression_Start_20()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_start", new StringValues("20") }
            };
            var query = new QueryCollection(values);



            //Act
            var slice = SliceExpression.Extract(query);
            var text  = slice.ToString();



            //Assert
            text.Should().Be("_start=20");
        }