Ejemplo n.º 1
0
        public static void CheckSubTree(DependencyObject dObject, DObjectChecker checker, bool failIfNothingFound)
        {
            VisualTreeEnumerator visualTreeEnumerator = new VisualTreeEnumerator(dObject);
            DependencyObjectCheckerEnumerator dObjectCheckerEnumerator = new DependencyObjectCheckerEnumerator(checker);

            dObjectCheckerEnumerator.MoveNext();
            while (visualTreeEnumerator.MoveNext())
            {
                if (dObjectCheckerEnumerator.Current.CheckElement(visualTreeEnumerator.Current, visualTreeEnumerator.Level))
                {
                    DObjectChecker parent = (DObjectChecker)dObjectCheckerEnumerator.CurrentParent;
                    if (parent != null)
                    {
                        Assert.IsTrue(IsParent(dObjectCheckerEnumerator.Current.Element, parent.Element));
                    }
                    if (!dObjectCheckerEnumerator.MoveNext())
                    {
                        checker.CheckLevels();
                        return;
                    }
                }
            }
            if (failIfNothingFound)
            {
                Assert.Fail("Element not found: " + dObjectCheckerEnumerator.Current);
            }
        }
Ejemplo n.º 2
0
            public void CheckSubTree(DependencyObject dObject)
            {
                VisualTreeEnumerator visualTreeEnumerator = new VisualTreeEnumerator(dObject);
                DependencyObjectCheckerEnumerator dObjectCheckerEnumerator = new DependencyObjectCheckerEnumerator(this);

                dObjectCheckerEnumerator.MoveNext();
                while (visualTreeEnumerator.MoveNext())
                {
                    this.CheckElement(visualTreeEnumerator.Current, visualTreeEnumerator.Level);
                }
            }