public void PBS_NoGrandParent()
        {
            var mockTree = new FakeTreeView();
            var pbs      = new ProjectBrowserService(sc, tabPage.Object, mockTree);
            var p        = new ParentComponent();
            var c        = new TestComponent();

            pbs.AddComponents(new[] { p });
            pbs.AddComponents(p, new[] { c });

            var o = pbs.GetAncestorOfType <GrandParentComponent>(c);

            Assert.IsNull(o);
        }
Example #2
0
        public void PBS_FindGrandParent()
        {
            var mockTree = new FakeTreeView();
            var pbs      = new ProjectBrowserService(sc, mockTree);
            var gp       = new GrandParentComponent();
            var p        = new ParentComponent();
            var c        = new TestComponent();

            pbs.AddComponents(new[] { gp });
            pbs.AddComponents(gp, new[] { p });
            pbs.AddComponents(p, new[] { c });

            var o = pbs.GetAncestorOfType <GrandParentComponent>(c);

            Assert.AreSame(gp, o);
        }