Skip to content

Commit b861356

Browse files
committed
Have RunAllTestsCommand show Test Explorer. Closes #2584
1 parent 368b120 commit b861356

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ public override void Load()
120120
.InSingletonScope();
121121

122122
Bind<IDockablePresenter>().To<TestExplorerDockablePresenter>()
123-
.WhenInjectedInto<TestExplorerCommand>()
123+
.WhenInjectedInto(
124+
typeof (RunAllTestsCommand),
125+
typeof (TestExplorerCommand))
124126
.InSingletonScope();
125127

126128
Bind<IDockablePresenter>().To<CodeInspectionsDockablePresenter>()

RetailCoder.VBE/UI/Command/RunAllTestsCommand.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@ public class RunAllTestsCommand : CommandBase
1717
private readonly IVBE _vbe;
1818
private readonly ITestEngine _engine;
1919
private readonly TestExplorerModel _model;
20+
private readonly IDockablePresenter _presenter;
2021
private readonly RubberduckParserState _state;
21-
22-
public RunAllTestsCommand(IVBE vbe, RubberduckParserState state, ITestEngine engine, TestExplorerModel model)
22+
23+
public RunAllTestsCommand(IVBE vbe, RubberduckParserState state, ITestEngine engine, TestExplorerModel model, IDockablePresenter presenter)
2324
: base(LogManager.GetCurrentClassLogger())
2425
{
2526
_vbe = vbe;
2627
_engine = engine;
2728
_model = model;
2829
_state = state;
30+
_presenter = presenter;
2931
}
3032

3133
private static readonly ParserState[] AllowedRunStates = { ParserState.ResolvedDeclarations, ParserState.ResolvingReferences, ParserState.Ready };
@@ -76,6 +78,11 @@ private void RunTests()
7678
_model.ClearLastRun();
7779
_model.IsBusy = true;
7880

81+
if (_presenter != null)
82+
{
83+
_presenter.Show();
84+
}
85+
7986
stopwatch.Start();
8087
_engine.Run(_model.Tests);
8188
stopwatch.Stop();

RetailCoder.VBE/UI/UnitTesting/TestExplorerViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public TestExplorerViewModel(IVBE vbe,
4545

4646
_navigateCommand = new NavigateCommand();
4747

48-
_runAllTestsCommand = new RunAllTestsCommand(vbe, state, testEngine, model);
48+
_runAllTestsCommand = new RunAllTestsCommand(vbe, state, testEngine, model, null);
4949
_runAllTestsCommand.RunCompleted += RunCompleted;
5050

5151
_addTestModuleCommand = new AddTestModuleCommand(vbe, state, configService);

0 commit comments

Comments
 (0)