예제 #1
0
        private static string testFiltering(string filterInput)
        {
            var sifter  = new MySifterService();
            var context = DataContext.Instance;
            var model   = new SifterModel {
                Filter = filterInput
            };

            var query = context.SubUsers.Include(x => x.Inner);
            var sql   = sifter.Sift(query, model).ToSql();

            return(Regex.Replace(sql, "0+1E0", "")); //Removes all the trailing zeroes for easier testing and legibility
        }
예제 #2
0
        private static string testSorting(string sortInput)
        {
            var sifter  = new MySifterService();
            var context = DataContext.Instance;
            var model   = new SifterModel {
                Sort = sortInput
            };

            var query = context.SubUsers.Include(x => x.Inner);
            var sql   = sifter.Sift(query, model).ToSql(); //TODO a select() must always be after the sift

            return(sql);
        }
예제 #3
0
        //There are no tests for invalid pagination requests, because if a request is invalid, it will always use the default pagination options



        private static string testPagination(string page, string pageSize)
        {
            var sifter  = new MySifterService();
            var context = DataContext.Instance;
            var model   = new SifterModel {
                Page     = page,
                PageSize = pageSize
            };

            var query = context.SubUsers.Include(x => x.Inner);
            var sql   = sifter.Sift(query, model).ToSql();

            return(sql);
        }