示例#1
0
        public void GetSelfAndChildren_WhenNoChildren_ReturnsOnlySelf()
        {
            var s = new Child();

            CollectionAssert.AreEqual(
                new[] { s },
                ScreenTreeHelper.GetChildrenOf(s, includeSelf: true).ToArray()
                );
        }
示例#2
0
        public void GetSelfAndChildren_WithChildren_ReturnsSelfAndChildren()
        {
            var p = new Parent();
            var c = new Child();

            p.Children.Attach(c);

            var result = ScreenTreeHelper.GetChildrenOf(p, includeSelf: true).ToArray();

            CollectionAssert.Contains(result, p);
            CollectionAssert.Contains(result, c);
        }
示例#3
0
        public void GetSelfAndChildren_WithGrandchildren_ReturnsSelfAndChildrenOnly()
        {
            var p     = new Parent();
            var child = new Parent();
            var grand = new Child();

            p.Children.Attach(child);
            child.Children.Attach(grand);

            var result = ScreenTreeHelper.GetChildrenOf(p, includeSelf: true).ToArray();

            CollectionAssert.Contains(result, p);
            CollectionAssert.Contains(result, child);
            CollectionAssert.DoesNotContain(result, grand);
        }