Skip to content

Commit 01bd980

Browse files
committed
Rename and clarify ignore/unignore commands
1 parent b22821e commit 01bd980

File tree

2 files changed

+28
-22
lines changed

2 files changed

+28
-22
lines changed

Rubberduck.Core/UI/UnitTesting/TestExplorerControl.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,14 +454,15 @@
454454
<Image Source="{StaticResource UnignoreTestImage}" />
455455
</MenuItem.Icon>
456456
</MenuItem>
457-
<MenuItem Command="{Binding IgnoreSelectedGroupCommand}"
457+
458+
<MenuItem Command="{Binding IgnoreGroupCommand}"
458459
Header="{Resx ResxName=Rubberduck.Resources.UnitTesting.TestExplorer, Key=TestExplorer_ContextMenuIgnoreGroup}"
459460
Visibility="{Binding DisplayIgnoreGroupLabel, Converter={StaticResource BoolToVisibility}}">
460461
<MenuItem.Icon>
461462
<Image Source="{StaticResource IgnoreTestGroupImage}" />
462463
</MenuItem.Icon>
463464
</MenuItem>
464-
<MenuItem Command="{Binding UnignoreSelectedGroupCommand}"
465+
<MenuItem Command="{Binding UnignoreGroupCommand}"
465466
Header="{Resx ResxName=Rubberduck.Resources.UnitTesting.TestExplorer, Key=TestExplorer_ContextMenuUnignoreGroup}"
466467
Visibility="{Binding DisplayUnignoreGroupLabel, Converter={StaticResource BoolToVisibility}}">
467468
<MenuItem.Icon>

Rubberduck.Core/UI/UnitTesting/TestExplorerViewModel.cs

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public TestExplorerViewModel(ISelectionService selectionService,
6767
NavigateCommand = new NavigateCommand(selectionService);
6868
RunSingleTestCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSingleTestCommand, CanExecuteSingleTest);
6969
RunSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestsCommand, CanExecuteSelectedTestsCommand);
70-
RunSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunSelectedGroupCommand, CanExecuteSelectedGroupCommand);
70+
RunSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunSelectedGroupCommand, CanExecuteGroupCommand);
7171
CancelTestRunCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCancelTestRunCommand, CanExecuteCancelTestRunCommand);
7272
ResetResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteResetResultsCommand, CanExecuteResetResultsCommand);
7373
CopyResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCopyResultsCommand);
@@ -76,8 +76,8 @@ public TestExplorerViewModel(ISelectionService selectionService,
7676
ExpandAllCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteExpandAll);
7777
IgnoreTestCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreTestCommand);
7878
UnignoreTestCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreTestCommand);
79-
IgnoreSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreGroupCommand, CanIgnoreSelectedGroupCommand);
80-
UnignoreSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreGroupCommand, CanUnignoreSelectedGroupCommand);
79+
IgnoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreGroupCommand, CanIgnoreGroupCommand);
80+
UnignoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreGroupCommand, CanUnignoreGroupCommand);
8181

8282
RewritingManager = rewritingManager;
8383
AnnotationUpdater = annotationUpdater;
@@ -312,8 +312,8 @@ public bool DisplayIgnoreGroupLabel
312312
public CommandBase IgnoreTestCommand { get; }
313313
public CommandBase UnignoreTestCommand { get; }
314314

315-
public CommandBase IgnoreSelectedGroupCommand { get; }
316-
public CommandBase UnignoreSelectedGroupCommand { get; }
315+
public CommandBase IgnoreGroupCommand { get; }
316+
public CommandBase UnignoreGroupCommand { get; }
317317

318318
#endregion
319319

@@ -329,19 +329,19 @@ private bool CanExecuteSelectedTestsCommand(object obj)
329329
return !Model.IsBusy && obj is IList viewModels && viewModels.Count > 0;
330330
}
331331

332-
private bool CanExecuteSelectedGroupCommand(object obj)
332+
private bool CanExecuteGroupCommand(object obj)
333333
{
334334
return !Model.IsBusy && (MouseOverTest != null || MouseOverGroup != null);
335335
}
336336

337-
private bool CanIgnoreSelectedGroupCommand(object obj)
337+
private bool CanIgnoreGroupCommand(object obj)
338338
{
339-
return CanExecuteSelectedGroupCommand(obj);
339+
return CanExecuteGroupCommand(obj);
340340
}
341341

342-
private bool CanUnignoreSelectedGroupCommand(object obj)
342+
private bool CanUnignoreGroupCommand(object obj)
343343
{
344-
return CanExecuteSelectedGroupCommand(obj);
344+
return CanExecuteGroupCommand(obj);
345345
}
346346

347347
private bool CanExecuteResetResultsCommand(object obj)
@@ -460,16 +460,21 @@ private void ExecuteIgnoreGroupCommand (object parameter)
460460

461461
foreach (TestMethodViewModel test in testGroup.Items)
462462
{
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)
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+
//}
476+
477+
if (!test.Method.IsIgnored)
473478
{
474479
AnnotationUpdater.AddAnnotation(rewriteSession, test.Method.Declaration, ignoreTestAnnotation);
475480
}

0 commit comments

Comments
 (0)