@@ -140,6 +140,8 @@ private void RefreshContextMenu()
140
140
{
141
141
OnPropertyChanged ( nameof ( DisplayUnignoreTestLabel ) ) ;
142
142
OnPropertyChanged ( nameof ( DisplayIgnoreTestLabel ) ) ;
143
+ OnPropertyChanged ( nameof ( DisplayUnignoreGroupLabel ) ) ;
144
+ OnPropertyChanged ( nameof ( DisplayIgnoreGroupLabel ) ) ;
143
145
}
144
146
145
147
private static readonly Dictionary < TestExplorerGrouping , PropertyGroupDescription > GroupDescriptions = new Dictionary < TestExplorerGrouping , PropertyGroupDescription >
@@ -245,6 +247,36 @@ private void HandleTestCompletion(object sender, TestCompletedEventArgs e)
245
247
private TestMethod _mousedOverTestMethod => ( ( TestMethodViewModel ) SelectedItem ) . Method ;
246
248
public bool DisplayUnignoreTestLabel => SelectedItem != null && _mousedOverTestMethod . IsIgnored ;
247
249
public bool DisplayIgnoreTestLabel => SelectedItem != null && ! _mousedOverTestMethod . IsIgnored ;
250
+
251
+ public bool DisplayUnignoreGroupLabel
252
+ {
253
+ get
254
+ {
255
+ if ( MouseOverGroup ? . Items == null )
256
+ {
257
+ return false ;
258
+ }
259
+
260
+ var testsInGroup = MouseOverGroup . Items . Cast < TestMethodViewModel > ( ) ;
261
+
262
+ return testsInGroup . Where ( test => test . Method . IsIgnored ) . Any ( ) ; ;
263
+ }
264
+ }
265
+
266
+ public bool DisplayIgnoreGroupLabel
267
+ {
268
+ get
269
+ {
270
+ if ( MouseOverGroup ? . Items == null )
271
+ {
272
+ return false ;
273
+ }
274
+
275
+ var testsInGroup = MouseOverGroup . Items . Cast < TestMethodViewModel > ( ) ;
276
+
277
+ return testsInGroup . Where ( test => test . Method . IsIgnored ) . Count ( ) != MouseOverGroup . Items . Count ;
278
+ }
279
+ }
248
280
249
281
#region Commands
250
282
@@ -428,10 +460,19 @@ private void ExecuteIgnoreGroupCommand (object parameter)
428
460
429
461
foreach ( TestMethodViewModel test in testGroup . Items )
430
462
{
431
- // var testMethod = parameter == null
432
- // ? _mousedOverTestMethod
433
- // : (parameter as TestMethodViewModel).Method;
434
- AnnotationUpdater . AddAnnotation ( rewriteSession , test . Method . Declaration , ignoreTestAnnotation ) ;
463
+ var needsIgnoreAnnotationAdded = true ;
464
+ foreach ( var annotation in test . Method . Declaration . Annotations )
465
+ {
466
+ if ( annotation . Annotation is IgnoreTestAnnotation )
467
+ {
468
+ needsIgnoreAnnotationAdded = false ;
469
+ } ;
470
+ }
471
+
472
+ if ( needsIgnoreAnnotationAdded )
473
+ {
474
+ AnnotationUpdater . AddAnnotation ( rewriteSession , test . Method . Declaration , ignoreTestAnnotation ) ;
475
+ }
435
476
}
436
477
437
478
rewriteSession . TryRewrite ( ) ;
@@ -441,15 +482,11 @@ private void ExecuteUnignoreGroupCommand(object parameter)
441
482
{
442
483
var rewriteSession = RewritingManager . CheckOutCodePaneSession ( ) ;
443
484
var testGroup = GroupContainingSelectedTest ( MouseOverTest ) ;
485
+
444
486
foreach ( TestMethodViewModel test in testGroup . Items )
445
487
{
446
- //ExecuteUnignoreTestCommand(test);
447
- //var ignoreTestAnnotations = test.Method.Declaration.Annotations
448
- // .Where(iannotations => iannotations.AnnotationType == Parsing.Annotations.AnnotationType.IgnoreTest);
449
-
450
488
var ignoreTestAnnotations = test . Method . Declaration . Annotations
451
- . Where ( pta => pta . Annotation . Target == AnnotationTarget . Member
452
- && pta . AnnotationArguments . Contains ( "'@IgnoreTest" ) ) ;
489
+ . Where ( pta => pta . Annotation is IgnoreTestAnnotation ) ;
453
490
454
491
foreach ( var ignoreTestAnnotation in ignoreTestAnnotations )
455
492
{
0 commit comments