Skip to content

Commit 332b963

Browse files
committed
Make generic command execution check
1 parent c899e68 commit 332b963

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

Rubberduck.Core/UI/UnitTesting/TestExplorerViewModel.cs

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public TestExplorerViewModel(ISelectionService selectionService,
6666

6767
NavigateCommand = new NavigateCommand(selectionService);
6868
RunSingleTestCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSingleTestCommand, CanExecuteSingleTest);
69-
RunSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestsCommand, CanExecuteSelectedTestsCommand);
69+
RunSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteSelectedTestsCommand, CanExecuteSelectionCommand);
7070
RunSelectedGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunSelectedGroupCommand, CanExecuteGroupCommand);
7171
CancelTestRunCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteCancelTestRunCommand, CanExecuteCancelTestRunCommand);
7272
ResetResultsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteResetResultsCommand, CanExecuteResetResultsCommand);
@@ -76,10 +76,10 @@ 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-
IgnoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreGroupCommand, CanIgnoreGroupCommand);
80-
UnignoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreGroupCommand, CanUnignoreGroupCommand);
81-
IgnoreSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreSelectedTestsCommand, CanExecuteSelectedTestsCommand);
82-
UnignoreSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreSelectedTestsCommand, CanUnignoreSelectedTestsCommand);
79+
IgnoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreGroupCommand, CanExecuteGroupCommand);
80+
UnignoreGroupCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreGroupCommand, CanExecuteGroupCommand);
81+
IgnoreSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteIgnoreSelectedTestsCommand, CanExecuteSelectionCommand);
82+
UnignoreSelectedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteUnignoreSelectedTestsCommand, CanExecuteSelectionCommand);
8383

8484
RewritingManager = rewritingManager;
8585
AnnotationUpdater = annotationUpdater;
@@ -329,31 +329,16 @@ private bool CanExecuteSingleTest(object obj)
329329
return !Model.IsBusy && MouseOverTest != null;
330330
}
331331

332-
private bool CanExecuteSelectedTestsCommand(object obj)
332+
private bool CanExecuteSelectionCommand(object obj)
333333
{
334334
return !Model.IsBusy && obj is IList viewModels && viewModels.Count > 0;
335335
}
336336

337-
private bool CanUnignoreSelectedTestsCommand(object obj)
338-
{
339-
return true;
340-
}
341-
342337
private bool CanExecuteGroupCommand(object obj)
343338
{
344339
return !Model.IsBusy && (MouseOverTest != null || MouseOverGroup != null);
345340
}
346341

347-
private bool CanIgnoreGroupCommand(object obj)
348-
{
349-
return CanExecuteGroupCommand(obj);
350-
}
351-
352-
private bool CanUnignoreGroupCommand(object obj)
353-
{
354-
return CanExecuteGroupCommand(obj);
355-
}
356-
357342
private bool CanExecuteResetResultsCommand(object obj)
358343
{
359344
return !Model.IsBusy && Tests.OfType<TestMethodViewModel>().Any(test => test.Result.Outcome != TestOutcome.Unknown);

0 commit comments

Comments
 (0)