@@ -1488,9 +1488,11 @@ internal async Task TestSourceGenerationExecution_RazorGeneratorAlwaysRuns_Other
1488
1488
var globalOptionService = workspace . ExportProvider . GetExportedValue < IGlobalOptionService > ( ) ;
1489
1489
globalOptionService . SetGlobalOption ( WorkspaceConfigurationOptionsStorage . SourceGeneratorExecution , executionPreference ) ;
1490
1490
1491
- var callCount = 0 ;
1492
- var generator1 = new CallbackGenerator ( ( ) => ( "hintName.cs" , "// callCount: " + callCount ++ ) ) ;
1493
- var generator2 = new Microsoft . NET . Sdk . Razor . SourceGenerators . RazorSourceGenerator ( ) ;
1491
+ var callBackCallCount = 0 ;
1492
+ var generator1 = new CallbackGenerator ( ( ) => ( "hintName.cs" , "// callCount: " + callBackCallCount ++ ) ) ;
1493
+
1494
+ var razorCallCount = 0 ;
1495
+ var generator2 = new Microsoft . NET . Sdk . Razor . SourceGenerators . RazorSourceGenerator ( ( c ) => c . AddSource ( "file.cs" , "// callCount: " + razorCallCount ++ ) ) ;
1494
1496
1495
1497
var projectId = ProjectId . CreateNewId ( ) ;
1496
1498
var project = workspace . CurrentSolution
@@ -1506,25 +1508,29 @@ internal async Task TestSourceGenerationExecution_RazorGeneratorAlwaysRuns_Other
1506
1508
Assert . True ( workspace . SetCurrentSolution ( _ => tempDoc . Project . Solution , WorkspaceChangeKind . SolutionChanged ) ) ;
1507
1509
1508
1510
// Initial: all generators run
1509
- await ValidateSourceGeneratorDocuments ( expectedCallback : 0 ,
1510
- expectedRazor : 0 ) ;
1511
+ await ValidateSourceGeneratorDocuments (
1512
+ expectedCallback : 0 ,
1513
+ expectedRazor : 0 ) ;
1511
1514
1512
1515
// Now, make a simple edit to the main document.
1513
1516
Contract . ThrowIfFalse ( workspace . TryApplyChanges ( workspace . CurrentSolution . WithDocumentText ( tempDoc . Id , SourceText . From ( "// new text" ) ) ) ) ;
1514
1517
1515
- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1516
- expectedRazor : 1 ) ;
1518
+ await ValidateSourceGeneratorDocuments (
1519
+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1520
+ expectedRazor : 1 ) ;
1517
1521
1518
1522
// Get the documents again and ensure nothing ran
1519
- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1520
- expectedRazor : 1 ) ;
1523
+ await ValidateSourceGeneratorDocuments (
1524
+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1525
+ expectedRazor : 1 ) ;
1521
1526
1522
1527
// Make another change, but this time enqueue an update too
1523
1528
Contract . ThrowIfFalse ( workspace . TryApplyChanges ( workspace . CurrentSolution . WithDocumentText ( tempDoc . Id , SourceText . From ( "// more new text" ) ) ) ) ;
1524
1529
workspace . EnqueueUpdateSourceGeneratorVersion ( projectId : null , forceRegeneration : false ) ;
1525
1530
1526
- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 2 : 1 ,
1527
- expectedRazor : 2 ) ;
1531
+ await ValidateSourceGeneratorDocuments (
1532
+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 2 : 1 ,
1533
+ expectedRazor : 2 ) ;
1528
1534
1529
1535
async Task ValidateSourceGeneratorDocuments ( int expectedCallback , int expectedRazor )
1530
1536
{
0 commit comments