Пример #1
0
        public void ParentSetViaConstructor()
        {
            var expected = TestHelper.CreateElement("Parent", "Parent");
            var element = new ElementOne("One", "One", expected);

            Assert.AreEqual(expected, element.Parent);
        }
Пример #2
0
        public void DescendantsWithGenericAndDescendants()
        {
            var host = TestHelper.CreateHost();
            var parent1 = new ElementOne("E1", "E1", host);
            var parent1Child1 = new ElementOne("E1C1", "E1C1", parent1);
            parent1Child1.Children.Add(new ElementTwo("E1C1G2", "E1C1G2", parent1Child1));
            parent1Child1.Children.Add(new ElementOne("E1C1G1", "E1C1G1", parent1Child1));
            parent1.Children.Add(parent1Child1);
            host.Children.Add(parent1);
            host.Children.Add(new ElementTwo("E2", "E2", host));
            var parent2 = new ElementOne("E1.1", "E1.1", host);
            parent2.Children.Add(new ElementOne("E1.1C1", "E1.1C1", parent2));
            host.Children.Add(parent2);
            host.Children.Add(new ElementTwo("E2.1", "E2.1", host));

            var expected = new[]
            {
                (ElementOne) host.Children[0],
                (ElementOne) host.Children[2],
                (ElementOne) host.Children[0].Children[0],
                (ElementOne) host.Children[0].Children[0].Children[1],
                (ElementOne) host.Children[2].Children[0]
            };

            var actual = host.Children.Descendants<ElementOne>(x => true).ToArray();
            TestHelper.AreEqual(expected, actual);
        }
Пример #3
0
        public void WaitWithProvidedInput()
        {
            var host = TestHelper.CreateHost();
            var expected = new ElementOne("1", "1", host);
            Element actualInput = null;

            var actual = Utility.Wait(expected, x =>
            {
                actualInput = x;
                return true;
            });

            Assert.IsTrue(actual);
            Assert.AreEqual(expected, actualInput);
        }
Пример #4
0
        public void FirstWithIncludeDescendantsDefaultValueOfTrue()
        {
            var host = TestHelper.CreateHost();
            var parent = new ElementOne("One", "One", host);
            var expected = new ElementOne("One2", "One2", host);
            parent.Children.Add(expected);

            host.Children.Add(parent);
            host.Children.Add(new ElementTwo("Two", "Two", host));

            var actual = host.Children.First<ElementOne>("One2");
            Assert.AreEqual(expected, actual);
        }