@@ -99,7 +99,7 @@ public void AddEvaluationChanges_CanAddItemWithMetadata()
99
99
var difference = IProjectChangeDiffFactory . WithAddedItems ( "A.cs" ) ;
100
100
var metadata = MetadataFactory . Create ( "A.cs" , ( "Name" , "Value" ) ) ;
101
101
102
- ApplyProjectEvaluation ( context , handler , 1 , difference , metadata ) ;
102
+ ApplyProjectEvaluation ( context , handler , 1 , difference , metadata : metadata ) ;
103
103
104
104
var result = handler . Files [ @"C:\Project\A.cs" ] ;
105
105
@@ -117,7 +117,7 @@ public void AddEvaluationChanges_ItemsWithExclusionMetadataAreIgnored()
117
117
. Add ( "B.cs" , ( "ExcludeFromCurrentConfiguration" , "false" ) ) ;
118
118
119
119
120
- ApplyProjectEvaluation ( context , handler , 1 , difference , metadata ) ;
120
+ ApplyProjectEvaluation ( context , handler , 1 , difference , metadata : metadata ) ;
121
121
122
122
string [ ] expectedFiles = new [ ] { @"C:\Project\B.cs" , @"C:\Project\C.cs" } ;
123
123
Assert . Equal ( expectedFiles . OrderBy ( f => f ) , handler . FileNames . OrderBy ( f => f ) ) ;
@@ -311,7 +311,7 @@ public void ApplyProjectEvaluationChanges_WithExistingEvaluationChanges_CanAddCh
311
311
var difference = IProjectChangeDiffFactory . WithChangedItems ( file ) ;
312
312
var metadata = MetadataFactory . Create ( file , ( "Name" , "Value" ) ) ;
313
313
314
- ApplyProjectEvaluation ( context , handler , 2 , difference , metadata ) ;
314
+ ApplyProjectEvaluation ( context , handler , 2 , difference , metadata : metadata ) ;
315
315
316
316
var result = handler . Files [ @"C:\Project\A.cs" ] ;
317
317
@@ -372,10 +372,56 @@ public void ApplyProjectBuild_WhenOlderEvaluationChangesWithRemovedConflict_Desi
372
372
Assert . Single ( handler . FileNames , @"C:\Project\Source.cs" ) ;
373
373
}
374
374
375
- private static void ApplyProjectEvaluation ( IWorkspaceProjectContext context , AbstractEvaluationCommandLineHandler handler , IComparable version , IProjectChangeDiff difference , IImmutableDictionary < string , IImmutableDictionary < string , string > > ? metadata = null )
375
+ [ Fact ]
376
+ public void ApplyProjectEvaluation_ChangingExclusionMetadata_IncludesFile ( )
377
+ {
378
+ var handler = CreateInstance ( @"C:\Project\Project.csproj" ) ;
379
+ var context = IWorkspaceProjectContextMockFactory . Create ( ) ;
380
+
381
+ var metadata = MetadataFactory . Create ( "Source.cs" , ( "ExcludeFromCurrentConfiguration" , "true" ) ) ;
382
+
383
+ ApplyProjectEvaluation ( context , handler , version : 0 , IProjectChangeDiffFactory . WithAddedItems ( "Source.cs" ) , metadata : metadata ) ;
384
+
385
+ Assert . Empty ( handler . FileNames ) ;
386
+
387
+ var previousMetadata = metadata ;
388
+ metadata = MetadataFactory . Create ( "Source.cs" , ( "ExcludeFromCurrentConfiguration" , "false" ) ) ;
389
+
390
+ ApplyProjectEvaluation ( context , handler , version : 1 , IProjectChangeDiffFactory . WithChangedItems ( "Source.cs" ) , previousMetadata , metadata ) ;
391
+
392
+ Assert . Single ( handler . FileNames , @"C:\Project\Source.cs" ) ;
393
+ }
394
+
395
+ [ Fact ]
396
+ public void ApplyProjectEvaluation_ChangingExclusionMetadata_ExcludesFile ( )
397
+ {
398
+ var handler = CreateInstance ( @"C:\Project\Project.csproj" ) ;
399
+ var context = IWorkspaceProjectContextMockFactory . Create ( ) ;
400
+
401
+ var metadata = MetadataFactory . Create ( "Source.cs" , ( "ExcludeFromCurrentConfiguration" , "false" ) ) ;
402
+
403
+ ApplyProjectEvaluation ( context , handler , version : 0 , IProjectChangeDiffFactory . WithAddedItems ( "Source.cs" ) , metadata : metadata ) ;
404
+
405
+ Assert . Single ( handler . FileNames , @"C:\Project\Source.cs" ) ;
406
+
407
+ var previousMetadata = metadata ;
408
+ metadata = MetadataFactory . Create ( "Source.cs" , ( "ExcludeFromCurrentConfiguration" , "true" ) ) ;
409
+
410
+ ApplyProjectEvaluation ( context , handler , version : 1 , IProjectChangeDiffFactory . WithChangedItems ( "Source.cs" ) , previousMetadata , metadata ) ;
411
+
412
+ Assert . Empty ( handler . FileNames ) ;
413
+ }
414
+
415
+ private static void ApplyProjectEvaluation (
416
+ IWorkspaceProjectContext context ,
417
+ AbstractEvaluationCommandLineHandler handler ,
418
+ IComparable version ,
419
+ IProjectChangeDiff difference ,
420
+ IImmutableDictionary < string , IImmutableDictionary < string , string > > ? previousMetadata = null ,
421
+ IImmutableDictionary < string , IImmutableDictionary < string , string > > ? metadata = null )
376
422
{
377
423
metadata ??= ImmutableDictionary < string , IImmutableDictionary < string , string > > . Empty ;
378
- var previousMetadata = ImmutableDictionary < string , IImmutableDictionary < string , string > > . Empty ;
424
+ previousMetadata ?? = ImmutableDictionary < string , IImmutableDictionary < string , string > > . Empty ;
379
425
bool isActiveContext = true ;
380
426
var logger = IManagedProjectDiagnosticOutputServiceFactory . Create ( ) ;
381
427
0 commit comments