@@ -28,7 +28,7 @@ public void Test2()
2828 [ InlineData ( WhitespaceOption . RemoveWhitespaceNodes ) ]
2929 public void Test5 ( WhitespaceOption whitespaceOption )
3030 {
31- var comparison = ToComparison ( "hello world" , " hello world " ) ;
31+ var comparison = ToComparison ( "hello world" , " hello world " ) ;
3232 var sut = new TextNodeComparer ( whitespaceOption ) ;
3333
3434 sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Different ) ;
@@ -52,7 +52,7 @@ public void Test7(string whitespace)
5252 {
5353 var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
5454 var normalText = "text" ;
55- var whitespaceText = $ "{ whitespace } text{ whitespace } ";
55+ var whitespaceText = $ "{ whitespace } text { whitespace } ";
5656 var c1 = ToComparison ( normalText , normalText ) ;
5757 var c2 = ToComparison ( normalText , whitespaceText ) ;
5858 var c3 = ToComparison ( whitespaceText , normalText ) ;
@@ -70,7 +70,7 @@ public void Test9(string whitespace)
7070 {
7171 var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
7272 var normalText = "hello world" ;
73- var whitespaceText = $ "{ whitespace } hello{ whitespace } { whitespace } world{ whitespace } ";
73+ var whitespaceText = $ " { whitespace } hello { whitespace } { whitespace } world { whitespace } ";
7474 var c1 = ToComparison ( normalText , normalText ) ;
7575 var c2 = ToComparison ( normalText , whitespaceText ) ;
7676 var c3 = ToComparison ( whitespaceText , normalText ) ;
@@ -131,22 +131,42 @@ public void Test005(string tag)
131131 sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Different ) ;
132132 }
133133
134- [ Theory ( DisplayName = "When the parent element is <pre/script/style> and the whitespace option is set inline, the inline option is used instead of Preserve" ) ]
134+ [ Theory ( DisplayName = "When the parent element is <pre/script/style> and the whitespace option is set " +
135+ "inline to Normalize, the inline option is used instead of Preserve" ) ]
135136 [ InlineData ( "pre" ) ]
136137 [ InlineData ( "script" ) ]
137138 [ InlineData ( "style" ) ]
138139 public void Test006 ( string tag )
139140 {
140141 var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
141- var elm = ToComparisonSource ( $ "<{ tag } diff:whitespace=\" normalize\" >foo bar</{ tag } >") ;
142- var controlSource = new ComparisonSource ( elm . Node . FirstChild , 0 , elm . Path , ComparisonSourceType . Control ) ;
143- var testSource = ToComparisonSource ( "foo bar" , ComparisonSourceType . Test ) ;
142+ var controlNode = ToNode ( $@ "<{ tag } diff:whitespace=""{ nameof ( WhitespaceOption . Normalize ) } "">foo bar</{ tag } >") ;
143+ var testNode = ToNode ( $@ "<{ tag } > foo bar </{ tag } >") ;
144+ var controlSource = controlNode . FirstChild . ToComparisonSource ( 0 , ComparisonSourceType . Control ) ;
145+ var testSource = testNode . FirstChild . ToComparisonSource ( 0 , ComparisonSourceType . Test ) ;
146+ var comparison = new Comparison ( controlSource , testSource ) ;
147+
148+ sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Same ) ;
149+ }
150+
151+ [ Theory ( DisplayName = "When the parent element is <pre/script/style> and the whitespace option is set " +
152+ "inline to RemoveWhitespaceNodes, the inline option is used instead of Preserve" ) ]
153+ [ InlineData ( "pre" ) ]
154+ [ InlineData ( "script" ) ]
155+ [ InlineData ( "style" ) ]
156+ public void Test007 ( string tag )
157+ {
158+ var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
159+ var controlNode = ToNode ( $@ "<{ tag } diff:whitespace=""{ nameof ( WhitespaceOption . RemoveWhitespaceNodes ) } "">foo bar</{ tag } >") ;
160+ var testNode = ToNode ( $@ "<{ tag } > foo bar </{ tag } >") ;
161+ var controlSource = controlNode . FirstChild . ToComparisonSource ( 0 , ComparisonSourceType . Control ) ;
162+ var testSource = testNode . FirstChild . ToComparisonSource ( 0 , ComparisonSourceType . Test ) ;
144163 var comparison = new Comparison ( controlSource , testSource ) ;
145164
146165 sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Same ) ;
147166 }
148167
149- [ Theory ( DisplayName = "When IgnoreCase='true' inline attribute is present in a parent element, a string ordinal ignore case comparison is performed" ) ]
168+ [ Theory ( DisplayName = "When IgnoreCase='true' inline attribute is present in a parent element, a string " +
169+ "ordinal ignore case comparison is performed" ) ]
150170 [ InlineData ( @"<header><h1><em diff:ignoreCase=""true"">HELLO WoRlD</em></h1></header>" ) ]
151171 [ InlineData ( @"<header><h1 diff:ignoreCase=""True""><em>HELLO WoRlD</em></h1></header>" ) ]
152172 [ InlineData ( @"<header diff:ignoreCase=""TRUE""><h1><em>HELLO WoRlD</em></h1></header>" ) ]
0 commit comments