@@ -358,9 +358,10 @@ private void ExecuteSelectedTestsCommand(object obj)
358
358
359
359
private void ExecuteRunSelectedGroupCommand ( object obj )
360
360
{
361
- var tests = MouseOverTest is null
362
- ? MouseOverGroup
363
- : Tests . Groups . OfType < CollectionViewGroup > ( ) . FirstOrDefault ( group => group . Items . Contains ( MouseOverTest ) ) ;
361
+ //var tests = MouseOverTest is null
362
+ // ? MouseOverGroup
363
+ // : Tests.Groups.OfType<CollectionViewGroup>().FirstOrDefault(group => group.Items.Contains(MouseOverTest));
364
+ var tests = GroupContainingSelectedTest ( MouseOverTest ) ;
364
365
365
366
if ( tests is null )
366
367
{
@@ -370,6 +371,13 @@ private void ExecuteRunSelectedGroupCommand(object obj)
370
371
Model . ExecuteTests ( tests . Items . OfType < TestMethodViewModel > ( ) . ToList ( ) ) ;
371
372
}
372
373
374
+ private CollectionViewGroup GroupContainingSelectedTest ( TestMethodViewModel selectedTest )
375
+ {
376
+ return selectedTest is null
377
+ ? MouseOverGroup
378
+ : Tests . Groups . OfType < CollectionViewGroup > ( ) . FirstOrDefault ( group => group . Items . Contains ( selectedTest ) ) ;
379
+ }
380
+
373
381
private void ExecuteCancelTestRunCommand ( object parameter )
374
382
{
375
383
Model . CancelTestRun ( ) ;
@@ -389,24 +397,16 @@ private void ExecuteIgnoreTestCommand(object parameter)
389
397
{
390
398
var rewriteSession = RewritingManager . CheckOutCodePaneSession ( ) ;
391
399
392
- var testMethod = parameter == null
393
- ? _mousedOverTestMethod
394
- : ( parameter as TestMethodViewModel ) . Method ;
395
-
396
- AnnotationUpdater . AddAnnotation ( rewriteSession , testMethod . Declaration , Parsing . Annotations . AnnotationType . IgnoreTest ) ;
400
+ AnnotationUpdater . AddAnnotation ( rewriteSession , _mousedOverTestMethod . Declaration , Parsing . Annotations . AnnotationType . IgnoreTest ) ;
397
401
398
402
rewriteSession . TryRewrite ( ) ;
399
403
}
400
404
401
405
private void ExecuteUnignoreTestCommand ( object parameter )
402
406
{
403
407
var rewriteSession = RewritingManager . CheckOutCodePaneSession ( ) ;
404
-
405
- var testMethod = parameter == null
406
- ? _mousedOverTestMethod
407
- : ( parameter as TestMethodViewModel ) . Method ;
408
408
409
- var ignoreTestAnnotations = testMethod . Declaration . Annotations
409
+ var ignoreTestAnnotations = _mousedOverTestMethod . Declaration . Annotations
410
410
. Where ( iannotations => iannotations . AnnotationType == Parsing . Annotations . AnnotationType . IgnoreTest ) ;
411
411
412
412
foreach ( var ignoreTestAnnotation in ignoreTestAnnotations )
@@ -419,18 +419,36 @@ private void ExecuteUnignoreTestCommand(object parameter)
419
419
420
420
private void ExecuteIgnoreGroupCommand ( object parameter )
421
421
{
422
- foreach ( TestMethodViewModel test in _mouseOverGroup . Items )
422
+ var rewriteSession = RewritingManager . CheckOutCodePaneSession ( ) ;
423
+ var testGroup = GroupContainingSelectedTest ( MouseOverTest ) ;
424
+ foreach ( TestMethodViewModel test in testGroup . Items )
423
425
{
424
- ExecuteIgnoreTestCommand ( test ) ;
426
+ // var testMethod = parameter == null
427
+ // ? _mousedOverTestMethod
428
+ // : (parameter as TestMethodViewModel).Method;
429
+ AnnotationUpdater . AddAnnotation ( rewriteSession , test . Method . Declaration , Parsing . Annotations . AnnotationType . IgnoreTest ) ;
425
430
}
431
+
432
+ rewriteSession . TryRewrite ( ) ;
426
433
}
427
434
428
435
private void ExecuteUnignoreGroupCommand ( object parameter )
429
436
{
430
- foreach ( TestMethodViewModel test in _mouseOverGroup . Items )
437
+ var rewriteSession = RewritingManager . CheckOutCodePaneSession ( ) ;
438
+ var testGroup = GroupContainingSelectedTest ( MouseOverTest ) ;
439
+ foreach ( TestMethodViewModel test in testGroup . Items )
431
440
{
432
- ExecuteUnignoreTestCommand ( test ) ;
441
+ //ExecuteUnignoreTestCommand(test);
442
+ var ignoreTestAnnotations = test . Method . Declaration . Annotations
443
+ . Where ( iannotations => iannotations . AnnotationType == Parsing . Annotations . AnnotationType . IgnoreTest ) ;
444
+
445
+ foreach ( var ignoreTestAnnotation in ignoreTestAnnotations )
446
+ {
447
+ AnnotationUpdater . RemoveAnnotation ( rewriteSession , ignoreTestAnnotation ) ;
448
+ }
433
449
}
450
+
451
+ rewriteSession . TryRewrite ( ) ;
434
452
}
435
453
436
454
private void ExecuteCopyResultsCommand ( object parameter )
0 commit comments