public void TestUnion()
        {
            const int resultRowCount = 5;
            // create QueryDesigner with ElementType == Products
            var queryDesinger = new QueryDesigner(context, typeof(Products));

            //create root node which elementType has the same type in queryDesigner
            var root = new JoinNode(typeof(Products));

            // create child node Categories with propertyName "Products".
            // Because Categories linked with Products by next property:
            // public EntitySet<Products> Products
            var categoryNode = new JoinNode(typeof(Categories), "Category", "Products");

            // add categoryNode to root node
            root.AddChildren(categoryNode);

            // create filter by Products.ProductName like "%l%"
            var productNameCondition = new Condition("ProductName", "l", ConditionOperator.Like);
            root.AddConditions(productNameCondition);

            // create filter by Categories.Description like "Sweet%"
            var categoryNameCondition = new Condition("Description", "Sweet", ConditionOperator.StartsWith, typeof(Categories));
            categoryNode.AddConditions(categoryNameCondition);

            // create ordering, because we call Skip and Take method.
            Ordering order = new Ordering("ProductName");

            // make join Products table with Categories filtered by conditions
            // and ordered by already created ordering
            queryDesinger.Join(root, new OrderingList(order));

            QueryDesigner cloneQueryDesigner = (QueryDesigner)queryDesinger.Clone();

            queryDesinger.Skip(0).Take(3);
            cloneQueryDesigner.Skip(2).Take(4);

            queryDesinger.Union(cloneQueryDesigner);

            var list = new List<Products>(queryDesinger.Cast<Products>());
            Assert.AreEqual(resultRowCount, list.Count);
        }
        public void TestExcept()
        {
            const int resultRowCount = 2;
            // create QueryDesigner with ElementType == Product
            var queryDesinger = new QueryDesigner(context, typeof(Product));

            //create root node which elementType has the same type in queryDesigner
            var root = new JoinNode(typeof(Product));

            // create child node Category with propertyName "Products".
            // Because Category linked with Product by next property:
            // public EntitySet<Product> Products
            var categoryNode = new JoinNode(typeof(Category),  "Category", "Products");

            // add categoryNode to root node
            root.AddChildren(categoryNode);

            // create filter by Product.ProductName like "%l%"
            var productNameCondition = new Condition("ProductName", "l", ConditionOperator.Like);
            // create filter by Category.Description like "Sweet%"
            var categoryNameCondition = new Condition("Description", "Sweet", ConditionOperator.StartsWith, typeof(Category));

            // create condition list with already created conditions
            var conditionList = new ConditionList(productNameCondition, categoryNameCondition);

            // make join Product table with Category filtered by conditions
            // and ordered by already created ordering
            queryDesinger = queryDesinger.Join(root, conditionList);

            QueryDesigner cloneQueryDesigner = (QueryDesigner)queryDesinger.Clone();

            queryDesinger = queryDesinger.Skip(0).Take(3);
            cloneQueryDesigner = cloneQueryDesigner.Skip(2).Take(4);

            queryDesinger = queryDesinger.Except(cloneQueryDesigner);

            var list = new List<Product>(queryDesinger.Cast<Product>());
            Assert.AreEqual(resultRowCount, list.Count);
        }