Ejemplo n.º 1
0
        public void Test002(string controlHtml, string testHtml)
        {
            var controls = ToSourceCollection(controlHtml, ComparisonSourceType.Control);
            var tests    = ToSourceCollection(testHtml, ComparisonSourceType.Test);

            var actual = ForwardSearchingNodeMatcher.Match(DummyContext, controls, tests).ToList();

            actual.ShouldBeEmpty();
        }
Ejemplo n.º 2
0
        public void Test001(string controlHtml, string testHtml)
        {
            var controls = ToSourceCollection(controlHtml, ComparisonSourceType.Control);
            var tests    = ToSourceCollection(testHtml, ComparisonSourceType.Test);

            var actual = ForwardSearchingNodeMatcher.Match(DummyContext, controls, tests).ToList();

            actual.Count.ShouldBe(1);
            actual.ShouldAllBe((c, idx) => c.Control == controls[idx] && c.Test == tests[idx]);
        }
Ejemplo n.º 3
0
        public void Test004()
        {
            var controls = ToSourceCollection("<foo></foo><div></div>", ComparisonSourceType.Control);
            var tests    = ToSourceCollection("<div></div>", ComparisonSourceType.Test);

            var actual = ForwardSearchingNodeMatcher.Match(DummyContext, controls, tests).ToList();

            actual.Count.ShouldBe(1);
            actual[0].ShouldSatisfyAllConditions(
                c => c.Control.Index.ShouldBe(1),
                c => c.Test.Index.ShouldBe(0)
                );
        }
Ejemplo n.º 4
0
        public void Test0011(string controlHtml, string testHtml)
        {
            var controls = ToSourceCollection(controlHtml, ComparisonSourceType.Control);
            var tests    = ToSourceCollection(testHtml, ComparisonSourceType.Test);

            controls.Remove((in ComparisonSource x) => x.Node is IElement ? FilterDecision.Keep : FilterDecision.Exclude);
            tests.Remove((in ComparisonSource x) => x.Node is IElement ? FilterDecision.Keep : FilterDecision.Exclude);

            var actual = ForwardSearchingNodeMatcher.Match(DummyContext, controls, tests).ToList();

            actual.Count.ShouldBe(2);
            actual.ShouldAllBe(c => c.Control == controls[c.Control.Index] && c.Test == tests[c.Test.Index]);
        }
Ejemplo n.º 5
0
        public void Test005()
        {
            var controls = ToSourceCollection("<p></p>text<!--comment-->", ComparisonSourceType.Control);
            var tests    = ToSourceCollection("<!--comment--><p></p>text", ComparisonSourceType.Test);

            controls.MarkAsMatched(controls[0]); // mark <p> as matched
            tests.MarkAsMatched(tests[2]);       // mark text as matched

            var actual = ForwardSearchingNodeMatcher.Match(DummyContext, controls, tests).ToList();

            actual.Count.ShouldBe(1);
            actual[0].ShouldSatisfyAllConditions(
                c => c.Control.Index.ShouldBe(2),
                c => c.Test.Index.ShouldBe(0)
                );
        }