public void CanWhereOrderByDescriptorFromSortCollectionDescriptor()
        {
            //act
            SelectorLambdaOperatorDescriptor selectorLambdaOperatorDescriptor = serviceProvider.GetRequiredService <ISearchSelectorBuilder>().CreatePagingSelector
                                                                                (
                sortCollectionDescriptor,
                typeof(PersonalModel),
                searchFilterGroupDescriptor,
                "xxx"
                                                                                );

            SelectorLambdaOperator selectorLambdaOperator = (SelectorLambdaOperator)serviceProvider.GetRequiredService <IMapper>().MapToOperator(selectorLambdaOperatorDescriptor);
            Expression <Func <IQueryable <PersonalModel>, IQueryable <PersonalModel> > > selector = (Expression <Func <IQueryable <PersonalModel>, IQueryable <PersonalModel> > >)selectorLambdaOperator.Build();

            //assert
            AssertFilterStringIsCorrect
            (
                selector,
                "q => q.Where(f => (f.MiddleName.Contains(\"xxx\") OrElse (f.FirstName.Contains(\"xxx\") OrElse f.LastName.Contains(\"xxx\")))).OrderBy(s => s.FirstName).ThenBy(s => s.LastName).Skip(3).Take(2)"
            );
        }
Esempio n. 2
0
        public void CanOrderByDescriptorFromSortCollectionDescriptor()
        {
            //act
            SelectorLambdaOperatorDescriptor selectorLambdaOperatorDescriptor = serviceProvider.GetRequiredService <ISearchSelectorBuilder>().CreatePagingSelector
                                                                                (
                sortCollectionDescriptor,
                typeof(StudentModel),
                searchFilterGroupDescriptor,
                string.Empty
                                                                                );

            SelectorLambdaOperator selectorLambdaOperator = (SelectorLambdaOperator)serviceProvider.GetRequiredService <IMapper>().MapToOperator(selectorLambdaOperatorDescriptor);
            Expression <Func <IQueryable <StudentModel>, IQueryable <StudentModel> > > selector = (Expression <Func <IQueryable <StudentModel>, IQueryable <StudentModel> > >)selectorLambdaOperator.Build();

            //assert
            AssertFilterStringIsCorrect
            (
                selector,
                "q => q.OrderBy(s => s.FirstName).ThenBy(s => s.LastName).Skip(3).Take(2)"
            );
        }