Skip to content

Commit 1589ddc

Browse files
committed
Add ignore/unignore test group
Need to correct for multiple ignore group commands so that only a single @IgonoreTest annotation is added. Unignore isn't working and need to figure out the logic.
1 parent 0377913 commit 1589ddc

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Rubberduck.Core/UI/UnitTesting/TestExplorerViewModel.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -424,12 +424,14 @@ private void ExecuteIgnoreGroupCommand (object parameter)
424424
{
425425
var rewriteSession = RewritingManager.CheckOutCodePaneSession();
426426
var testGroup = GroupContainingSelectedTest(MouseOverTest);
427+
var ignoreTestAnnotation = new IgnoreTestAnnotation();
428+
427429
foreach (TestMethodViewModel test in testGroup.Items)
428430
{
429431
// var testMethod = parameter == null
430432
// ? _mousedOverTestMethod
431-
// : (parameter as TestMethodViewModel).Method;
432-
AnnotationUpdater.AddAnnotation(rewriteSession, test.Method.Declaration, Parsing.Annotations.AnnotationType.IgnoreTest);
433+
// : (parameter as TestMethodViewModel).Method;
434+
AnnotationUpdater.AddAnnotation(rewriteSession, test.Method.Declaration, ignoreTestAnnotation);
433435
}
434436

435437
rewriteSession.TryRewrite();
@@ -442,8 +444,12 @@ private void ExecuteUnignoreGroupCommand(object parameter)
442444
foreach (TestMethodViewModel test in testGroup.Items)
443445
{
444446
//ExecuteUnignoreTestCommand(test);
447+
//var ignoreTestAnnotations = test.Method.Declaration.Annotations
448+
// .Where(iannotations => iannotations.AnnotationType == Parsing.Annotations.AnnotationType.IgnoreTest);
449+
445450
var ignoreTestAnnotations = test.Method.Declaration.Annotations
446-
.Where(iannotations => iannotations.AnnotationType == Parsing.Annotations.AnnotationType.IgnoreTest);
451+
.Where(pta => pta.Annotation.Target == AnnotationTarget.Member
452+
&& pta.AnnotationArguments.Contains("'@IgnoreTest"));
447453

448454
foreach (var ignoreTestAnnotation in ignoreTestAnnotations)
449455
{

0 commit comments

Comments
 (0)