예제 #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);
        }
예제 #2
0
        public void OperatorCollectionExpression_With_like()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "name_like", new StringValues("Ale") }
            };
            var query = new QueryCollection(values);



            //Act
            var operatorCollection = OperatorCollectionExpression <UserMetaDataCriteria> .Extract(query);

            var text = operatorCollection.ToString();



            //Assert
            text.Should().Be("name_like=Ale");
            operatorCollection.Operators.Should().HaveCount(1);
        }
예제 #3
0
        public void OperatorCollectionExpression_With_gte_lte()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "age_gte", new StringValues("25") },
                { "age_lte", new StringValues("20") }
            };
            var query = new QueryCollection(values);



            //Act
            var operatorCollection = OperatorCollectionExpression <UserMetaDataCriteria> .Extract(query);

            var text = operatorCollection.ToString();



            //Assert
            text.Should().Be("age_gte=25&age_lte=20");
            operatorCollection.Operators.Should().HaveCount(2);
        }