@@ -65,8 +65,6 @@ public static TheoryData<string, string> WebPagesData
65
65
{ "Environment" , null } ,
66
66
// Testing InputTagHelper with File
67
67
{ "Input" , null } ,
68
- // Testing the LinkTagHelper
69
- { "Link" , null } ,
70
68
// Test ability to generate nearly identical HTML with MVC tag and HTML helpers.
71
69
// Only attribute order should differ.
72
70
{ "Order" , "/HtmlGeneration_Order/Submit" } ,
@@ -78,8 +76,6 @@ public static TheoryData<string, string> WebPagesData
78
76
{ "ProductList" , "/HtmlGeneration_Product" } ,
79
77
{ "ProductListUsingTagHelpers" , "/HtmlGeneration_Product" } ,
80
78
{ "ProductListUsingTagHelpersWithNullModel" , "/HtmlGeneration_Product" } ,
81
- // Testing the ScriptTagHelper
82
- { "Script" , null } ,
83
79
} ;
84
80
85
81
return data ;
@@ -118,26 +114,34 @@ public async Task HtmlGenerationWebSite_GeneratesExpectedResults(string action,
118
114
responseContent = responseContent . Trim ( ) ;
119
115
if ( antiforgeryPath == null )
120
116
{
121
- #if GENERATE_BASELINES
122
117
ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
123
- #else
124
118
Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
125
- #endif
126
119
}
127
120
else
128
121
{
129
122
var forgeryToken = AntiforgeryTestHelper . RetrieveAntiforgeryToken ( responseContent , antiforgeryPath ) ;
130
- #if GENERATE_BASELINES
131
- // Reverse usual substitution and insert a format item into the new file content.
132
- responseContent = responseContent . Replace ( forgeryToken , "{0}" ) ;
133
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
134
- #else
135
- expectedContent = string . Format ( CultureInfo . InvariantCulture , expectedContent , forgeryToken ) ;
136
- Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
137
- #endif
123
+
124
+ if ( ResourceFile . GenerateBaselines )
125
+ {
126
+ // Reverse usual substitution and insert a format item into the new file content.
127
+ responseContent = responseContent . Replace ( forgeryToken , "{0}" ) ;
128
+ ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
129
+ }
130
+ else
131
+ {
132
+ expectedContent = string . Format ( CultureInfo . InvariantCulture , expectedContent , forgeryToken ) ;
133
+ Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
134
+ }
138
135
}
139
136
}
140
137
138
+ [ ConditionalTheory ]
139
+ [ InlineData ( "Link" , null ) ]
140
+ [ InlineData ( "Script" , null ) ]
141
+ [ SkipOnHelix ( "https://github.com/dotnet/aspnetcore/issues/10423" ) ]
142
+ public Task HtmlGenerationWebSite_GeneratesExpectedResultsNotReadyForHelix ( string action , string antiforgeryPath )
143
+ => HtmlGenerationWebSite_GeneratesExpectedResults ( action , antiforgeryPath ) ;
144
+
141
145
[ Fact ]
142
146
[ QuarantinedTest ( "https://github.com/dotnet/aspnetcore/issues/25206" ) ]
143
147
public async Task HtmlGenerationWebSite_GeneratesExpectedResults_WithImageData ( )
@@ -167,11 +171,8 @@ public async Task HtmlGenerationWebSite_LinkGeneration_With21CompatibilityBehavi
167
171
Assert . Equal ( expectedMediaType , response . Content . Headers . ContentType ) ;
168
172
169
173
responseContent = responseContent . Trim ( ) ;
170
- #if GENERATE_BASELINES
171
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
172
- #else
173
- Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
174
- #endif
174
+
175
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
175
176
}
176
177
177
178
public static TheoryData < string , string > EncodedPagesData
@@ -183,11 +184,9 @@ public static TheoryData<string, string> EncodedPagesData
183
184
{ "AttributesWithBooleanValues" , null } ,
184
185
{ "EditWarehouse" , null } ,
185
186
{ "Index" , null } ,
186
- { "Link" , null } ,
187
187
{ "Order" , "/HtmlGeneration_Order/Submit" } ,
188
188
{ "OrderUsingHtmlHelpers" , "/HtmlGeneration_Order/Submit" } ,
189
189
{ "Product" , null } ,
190
- { "Script" , null } ,
191
190
} ;
192
191
}
193
192
}
@@ -214,29 +213,22 @@ public async Task HtmlGenerationWebSite_GenerateEncodedResults(string action, st
214
213
responseContent = responseContent . Trim ( ) ;
215
214
if ( antiforgeryPath == null )
216
215
{
217
- #if GENERATE_BASELINES
218
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
219
- #else
220
- Assert . Equal (
221
- expectedContent . Trim ( ) ,
222
- responseContent ,
223
- ignoreLineEndingDifferences : true ) ;
224
- #endif
216
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
225
217
}
226
218
else
227
219
{
228
- var forgeryToken = AntiforgeryTestHelper . RetrieveAntiforgeryToken ( responseContent , antiforgeryPath ) ;
229
- #if GENERATE_BASELINES
230
- // Reverse usual substitution and insert a format item into the new file content.
231
- responseContent = responseContent . Replace ( forgeryToken , "{0}" ) ;
232
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
233
- #else
234
- expectedContent = string . Format ( CultureInfo . InvariantCulture , expectedContent , forgeryToken ) ;
235
- Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
236
- #endif
220
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile , expectedContent , responseContent , token : AntiforgeryTestHelper . RetrieveAntiforgeryToken ( responseContent , antiforgeryPath ) ) ;
237
221
}
238
222
}
239
223
224
+
225
+ [ ConditionalTheory ]
226
+ [ InlineData ( "Link" , null ) ]
227
+ [ InlineData ( "Script" , null ) ]
228
+ [ SkipOnHelix ( "https://github.com/dotnet/aspnetcore/issues/10423" ) ]
229
+ public Task HtmlGenerationWebSite_GenerateEncodedResultsNotReadyForHelix ( string action , string antiforgeryPath )
230
+ => HtmlGenerationWebSite_GenerateEncodedResults ( action , antiforgeryPath ) ;
231
+
240
232
// Testing how ModelMetadata is handled as ViewDataDictionary instances are created.
241
233
[ Theory ]
242
234
[ InlineData ( "AtViewModel" ) ]
@@ -259,11 +251,7 @@ public async Task CheckViewData_GeneratesExpectedResults(string action)
259
251
Assert . Equal ( expectedMediaType , response . Content . Headers . ContentType ) ;
260
252
261
253
responseContent = responseContent . Trim ( ) ;
262
- #if GENERATE_BASELINES
263
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
264
- #else
265
- Assert . Equal ( expectedContent , responseContent , ignoreLineEndingDifferences : true ) ;
266
- #endif
254
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
267
255
}
268
256
269
257
[ Fact ]
@@ -293,17 +281,7 @@ public async Task ValidationTagHelpers_GeneratesExpectedSpansAndDivs()
293
281
Assert . Equal ( HttpStatusCode . OK , response . StatusCode ) ;
294
282
295
283
responseContent = responseContent . Trim ( ) ;
296
- var forgeryToken =
297
- AntiforgeryTestHelper . RetrieveAntiforgeryToken ( responseContent , "Customer/HtmlGeneration_Customer" ) ;
298
-
299
- #if GENERATE_BASELINES
300
- // Reverse usual substitution and insert a format item into the new file content.
301
- responseContent = responseContent . Replace ( forgeryToken , "{0}" ) ;
302
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile , expectedContent , responseContent ) ;
303
- #else
304
- expectedContent = string . Format ( CultureInfo . InvariantCulture , expectedContent , forgeryToken ) ;
305
- Assert . Equal ( expectedContent . Trim ( ) , responseContent , ignoreLineEndingDifferences : true ) ;
306
- #endif
284
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile , expectedContent , responseContent , token : AntiforgeryTestHelper . RetrieveAntiforgeryToken ( responseContent , "Customer/HtmlGeneration_Customer" ) ) ;
307
285
}
308
286
309
287
[ Fact ]
@@ -396,12 +374,12 @@ public async Task CacheTagHelper_CanCachePortionsOfViewsPartialViewsAndViewCompo
396
374
var response2 = await ( await Client . SendAsync ( request ) ) . Content . ReadAsStringAsync ( ) ;
397
375
398
376
// Assert - 1
399
- #if GENERATE_BASELINES
400
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile1 , expected1 , response1 . Trim ( ) ) ;
401
- #else
402
- Assert . Equal ( expected1 , response1 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
403
- Assert . Equal ( expected1 , response2 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
404
- #endif
377
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile1 , expected1 , response1 . Trim ( ) ) ;
378
+
379
+ if ( ! ResourceFile . GenerateBaselines )
380
+ {
381
+ Assert . Equal ( expected1 , response2 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
382
+ }
405
383
406
384
// Act - 2
407
385
// Verify content gets changed in partials when one of the vary by parameters is changed
@@ -412,12 +390,11 @@ public async Task CacheTagHelper_CanCachePortionsOfViewsPartialViewsAndViewCompo
412
390
var response4 = await ( await Client . SendAsync ( request ) ) . Content . ReadAsStringAsync ( ) ;
413
391
414
392
// Assert - 2
415
- #if GENERATE_BASELINES
416
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile2 , expected2 , response3 . Trim ( ) ) ;
417
- #else
418
- Assert . Equal ( expected2 , response3 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
419
- Assert . Equal ( expected2 , response4 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
420
- #endif
393
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile2 , expected2 , response3 . Trim ( ) ) ;
394
+ if ( ! ResourceFile . GenerateBaselines )
395
+ {
396
+ Assert . Equal ( expected2 , response4 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
397
+ }
421
398
422
399
// Act - 3
423
400
// Verify content gets changed in a View Component when the Vary-by-header parameters is changed
@@ -428,12 +405,11 @@ public async Task CacheTagHelper_CanCachePortionsOfViewsPartialViewsAndViewCompo
428
405
var response6 = await ( await Client . SendAsync ( request ) ) . Content . ReadAsStringAsync ( ) ;
429
406
430
407
// Assert - 3
431
- #if GENERATE_BASELINES
432
- ResourceFile . UpdateFile ( _resourcesAssembly , outputFile3 , expected3 , response5 . Trim ( ) ) ;
433
- #else
434
- Assert . Equal ( expected3 , response5 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
435
- Assert . Equal ( expected3 , response6 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
436
- #endif
408
+ ResourceFile . UpdateOrVerify ( _resourcesAssembly , outputFile3 , expected3 , response5 . Trim ( ) ) ;
409
+ if ( ! ResourceFile . GenerateBaselines )
410
+ {
411
+ Assert . Equal ( expected3 , response6 . Trim ( ) , ignoreLineEndingDifferences : true ) ;
412
+ }
437
413
}
438
414
439
415
[ Fact ]
0 commit comments