コード例 #1
0
ファイル: Criteria.cs プロジェクト: luonghongthuan/cqrs
        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 OrderByExpression_OrderBy_Empty()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_sort", new StringValues("namee,lastName") },
                { "_order", new StringValues("asc,asc") }
            };
            var query = new QueryCollection(values);



            //Act
            var sort = OrderByExpression <UserMetaDataCriteria> .Extract(query);



            //Assert
            sort.Should().BeNull();
        }
コード例 #3
0
        public void OrderByExpression_With_Two_Property()
        {
            //Arrange
            var values = new Dictionary <string, StringValues>
            {
                { "_sort", new StringValues("name,lastName") },
                { "_order", new StringValues("asc,asc") }
            };
            var query = new QueryCollection(values);



            //Act
            var sort = OrderByExpression <UserMetaDataCriteria> .Extract(query);

            var text = sort.ToString();



            //Assert
            text.Should().Be("_sort=name,lastName&_order=asc,asc");
        }