@@ -28,7 +28,7 @@ public void Test2()
28
28
[ InlineData ( WhitespaceOption . RemoveWhitespaceNodes ) ]
29
29
public void Test5 ( WhitespaceOption whitespaceOption )
30
30
{
31
- var comparison = ToComparison ( "hello world" , " hello world " ) ;
31
+ var comparison = ToComparison ( "hello world" , " hello world " ) ;
32
32
var sut = new TextNodeComparer ( whitespaceOption ) ;
33
33
34
34
sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Different ) ;
@@ -52,7 +52,7 @@ public void Test7(string whitespace)
52
52
{
53
53
var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
54
54
var normalText = "text" ;
55
- var whitespaceText = $ "{ whitespace } text{ whitespace } ";
55
+ var whitespaceText = $ "{ whitespace } text { whitespace } ";
56
56
var c1 = ToComparison ( normalText , normalText ) ;
57
57
var c2 = ToComparison ( normalText , whitespaceText ) ;
58
58
var c3 = ToComparison ( whitespaceText , normalText ) ;
@@ -70,7 +70,7 @@ public void Test9(string whitespace)
70
70
{
71
71
var sut = new TextNodeComparer ( WhitespaceOption . Normalize ) ;
72
72
var normalText = "hello world" ;
73
- var whitespaceText = $ "{ whitespace } hello{ whitespace } { whitespace } world{ whitespace } ";
73
+ var whitespaceText = $ " { whitespace } hello { whitespace } { whitespace } world { whitespace } ";
74
74
var c1 = ToComparison ( normalText , normalText ) ;
75
75
var c2 = ToComparison ( normalText , whitespaceText ) ;
76
76
var c3 = ToComparison ( whitespaceText , normalText ) ;
@@ -131,22 +131,42 @@ public void Test005(string tag)
131
131
sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Different ) ;
132
132
}
133
133
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" ) ]
135
136
[ InlineData ( "pre" ) ]
136
137
[ InlineData ( "script" ) ]
137
138
[ InlineData ( "style" ) ]
138
139
public void Test006 ( string tag )
139
140
{
140
141
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 ) ;
144
163
var comparison = new Comparison ( controlSource , testSource ) ;
145
164
146
165
sut . Compare ( comparison , CompareResult . Different ) . ShouldBe ( CompareResult . Same ) ;
147
166
}
148
167
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" ) ]
150
170
[ InlineData ( @"<header><h1><em diff:ignoreCase=""true"">HELLO WoRlD</em></h1></header>" ) ]
151
171
[ InlineData ( @"<header><h1 diff:ignoreCase=""True""><em>HELLO WoRlD</em></h1></header>" ) ]
152
172
[ InlineData ( @"<header diff:ignoreCase=""TRUE""><h1><em>HELLO WoRlD</em></h1></header>" ) ]
0 commit comments