MS.Internal.Xml.XPath.Query.AssertQuery C# (CSharp) Method

AssertQuery() private method

private AssertQuery ( Query query ) : void
query Query
return void
        public static void AssertQuery(Query query) {
            Debug.Assert(query != null, "AssertQuery(): query == null");
            if (query is FunctionQuery) return; // Temp Fix. Functions (as document()) return now unordered sequences
            query = Clone(query);
            XPathNavigator last = null;
            XPathNavigator curr;
            int querySize = query.Clone().Count;
            int actualSize = 0;
            while ((curr = query.Advance()) != null) {
                if (curr.GetType().ToString() == "Microsoft.VisualStudio.Modeling.StoreNavigator") return;
                if (curr.GetType().ToString() == "System.Xml.DataDocumentXPathNavigator") return;
                Debug.Assert(curr == query.Current, "AssertQuery(): query.Advance() != query.Current");
                if (last != null) {
                    if (last.NodeType == XPathNodeType.Namespace && curr.NodeType == XPathNodeType.Namespace) {
                        // NamespaceQuery reports namsespaces in mixed order.
                        // Ignore this for now. 
                        // It seams that this doesn't breake other queries becasue NS can't have children
                    } else {
                        XmlNodeOrder cmp = CompareNodes(last, curr);
                        Debug.Assert(cmp == XmlNodeOrder.Before, "AssertQuery(): Wrong node order");
                    }
                }
                last = curr.Clone();
                actualSize++;
            }
            Debug.Assert(actualSize == querySize, "AssertQuery(): actualSize != querySize");
        }