Пример #1
0
        public void Test004()
        {
            var sut        = new TextNodeComparer(ignoreCase: true);
            var comparison = ToComparison("HELLO WoRlD", "hello world");

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #2
0
        public void Test003(WhitespaceOption whitespaceOption)
        {
            var sut        = new TextNodeComparer(whitespaceOption);
            var comparison = ToComparison("  hello\n\nworld ", "  hello\n\nworld ");

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #3
0
        public void Test55()
        {
            var comparison = new Comparison();
            var sut        = new TextNodeComparer(WhitespaceOption.Normalize);

            sut.Compare(comparison, CompareResult.Same).ShouldBe(CompareResult.Same);
            sut.Compare(comparison, CompareResult.Skip).ShouldBe(CompareResult.Skip);
        }
Пример #4
0
        public void Test001(string controlHtml, string testHtml)
        {
            var sut           = new TextNodeComparer(WhitespaceOption.Preserve);
            var controlSource = new ComparisonSource(ToNode(controlHtml).FirstChild.FirstChild.FirstChild, 0, "dummypath", ComparisonSourceType.Control);
            var testSource    = new ComparisonSource(ToNode(testHtml).FirstChild.FirstChild.FirstChild, 0, "dummypath", ComparisonSourceType.Test);
            var comparison    = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #5
0
        public void Test2()
        {
            var comparison = ToComparison("<p></p>", "<p></p>");
            var sut        = new TextNodeComparer();

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Different);
            sut.Compare(comparison, CompareResult.Same).ShouldBe(CompareResult.Same);
            sut.Compare(comparison, CompareResult.Skip).ShouldBe(CompareResult.Skip);
        }
Пример #6
0
        public void Test012(string controlHtml)
        {
            var sut             = new TextNodeComparer();
            var paragraphSource = ToComparisonSource(controlHtml);
            var controlSource   = new ComparisonSource(paragraphSource.Node.FirstChild, 0, paragraphSource.Path, ComparisonSourceType.Control);
            var testSource      = ToComparisonSource("1234", ComparisonSourceType.Test);
            var comparison      = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #7
0
        public void Test011()
        {
            var sut             = new TextNodeComparer(ignoreCase: true);
            var paragraphSource = ToComparisonSource(@"<p diff:regex>FOO\d{4}</p>");
            var controlSource   = new ComparisonSource(paragraphSource.Node.FirstChild, 0, paragraphSource.Path, ComparisonSourceType.Control);
            var testSource      = ToComparisonSource("foo1234", ComparisonSourceType.Test);
            var comparison      = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #8
0
        public void Test009(string controlHtml)
        {
            var sut           = new TextNodeComparer(ignoreCase: true);
            var rootSource    = ToComparisonSource(controlHtml);
            var controlSource = new ComparisonSource(rootSource.Node.FirstChild.FirstChild.FirstChild, 0, rootSource.Path, ComparisonSourceType.Control);
            var testSource    = ToComparisonSource("hello world", ComparisonSourceType.Test);
            var comparison    = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Different);
        }
Пример #9
0
        public void Test005(string tag)
        {
            var sut           = new TextNodeComparer(WhitespaceOption.Normalize);
            var elm           = ToComparisonSource($"<{tag}>foo   bar</{tag}>");
            var controlSource = new ComparisonSource(elm.Node.FirstChild, 0, elm.Path, ComparisonSourceType.Control);
            var testSource    = ToComparisonSource("foo bar", ComparisonSourceType.Test);
            var comparison    = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Different);
        }
Пример #10
0
        public void Test007(string tag)
        {
            var sut           = new TextNodeComparer(WhitespaceOption.Normalize);
            var controlNode   = ToNode($@"<{tag} diff:whitespace=""{nameof(WhitespaceOption.RemoveWhitespaceNodes)}"">foo bar</{tag}>");
            var testNode      = ToNode($@"<{tag}>  foo bar   </{tag}>");
            var controlSource = controlNode.FirstChild.ToComparisonSource(0, ComparisonSourceType.Control);
            var testSource    = testNode.FirstChild.ToComparisonSource(0, ComparisonSourceType.Test);
            var comparison    = new Comparison(controlSource, testSource);

            sut.Compare(comparison, CompareResult.Different).ShouldBe(CompareResult.Same);
        }
Пример #11
0
        public void Test9(string whitespace)
        {
            var sut            = new TextNodeComparer(WhitespaceOption.Normalize);
            var normalText     = "hello world";
            var whitespaceText = $"  {whitespace}  hello  {whitespace} {whitespace} world  {whitespace}   ";
            var c1             = ToComparison(normalText, normalText);
            var c2             = ToComparison(normalText, whitespaceText);
            var c3             = ToComparison(whitespaceText, normalText);
            var c4             = ToComparison(whitespaceText, whitespaceText);

            sut.Compare(c1, CompareResult.Different).ShouldBe(CompareResult.Same);
            sut.Compare(c2, CompareResult.Different).ShouldBe(CompareResult.Same);
            sut.Compare(c3, CompareResult.Different).ShouldBe(CompareResult.Same);
            sut.Compare(c4, CompareResult.Different).ShouldBe(CompareResult.Same);
        }