Skip to content

Commit 12876be

Browse files
authored
Merge pull request #4277 from rkapka/rkapka-master
Test Explorer fixes
2 parents 25797e9 + 5284e60 commit 12876be

File tree

4 files changed

+18
-19
lines changed

4 files changed

+18
-19
lines changed

Rubberduck.Core/UI/UnitTesting/TestExplorerControl.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@
484484
<Border Grid.Row="0" Grid.RowSpan="3" Background="#FFEEF5FD" />
485485

486486
<ToolBarTray Grid.Row="0" IsLocked="True">
487-
<ToolBar IsEnabled="{Binding Model.IsReady}" Style="{StaticResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
487+
<ToolBar Style="{StaticResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
488488
<ToolBar.Resources>
489489
<Style TargetType="Image">
490490
<Setter Property="Height" Value="16" />

Rubberduck.Core/UI/UnitTesting/TestExplorerControl.xaml.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
using System;
2-
using System.Windows.Controls;
32
using System.Windows.Data;
43
using System.Windows.Threading;
5-
using System.Windows.Input;
64

75
namespace Rubberduck.UI.UnitTesting
86
{
@@ -37,9 +35,17 @@ private void OnTestCompleted(object sender, EventArgs eventArgs)
3735
{
3836
_dispatcher.Invoke(() =>
3937
{
40-
if (FindResource("ResultsByOutcome") is CollectionViewSource resource)
38+
if (FindResource("ResultsByOutcome") is CollectionViewSource outcome)
4139
{
42-
resource.View.Refresh();
40+
outcome.View.Refresh();
41+
}
42+
if (FindResource("ResultsByModule") is CollectionViewSource module)
43+
{
44+
module.View.Refresh();
45+
}
46+
if (FindResource("ResultsByCategory") is CollectionViewSource category)
47+
{
48+
category.View.Refresh();
4349
}
4450
});
4551
}

Rubberduck.Core/UI/UnitTesting/TestExplorerViewModel.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ public TestExplorerViewModel(IVBE vbe,
3434
IClipboardWriter clipboard,
3535
IGeneralConfigService configService,
3636
ISettingsFormFactory settingsFormFactory,
37-
IMessageBox messageBox)
37+
IMessageBox messageBox,
38+
ReparseCommand reparseCommand)
3839
{
3940
_vbe = vbe;
4041
_state = state;
@@ -54,7 +55,7 @@ public TestExplorerViewModel(IVBE vbe,
5455
AddTestMethodCommand = new AddTestMethodCommand(vbe, state);
5556
AddErrorTestMethodCommand = new AddTestMethodExpectedErrorCommand(vbe, state);
5657

57-
RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRefreshCommand, CanExecuteRefreshCommand);
58+
RefreshCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRefreshCommand, o => !Model.IsBusy && reparseCommand.CanExecute(o));
5859
RepeatLastRunCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRepeatLastRunCommand, CanExecuteRepeatLastRunCommand);
5960
RunNotExecutedTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunNotExecutedTestsCommand, CanExecuteRunNotExecutedTestsCommand);
6061
RunInconclusiveTestsCommand = new DelegateCommand(LogManager.GetCurrentClassLogger(), ExecuteRunInconclusiveTestsCommand, CanExecuteRunInconclusiveTestsCommand);
@@ -262,11 +263,6 @@ private void ExecuteRefreshCommand(object parameter)
262263
SelectedTest = null;
263264
}
264265

265-
private bool CanExecuteRefreshCommand(object parameter)
266-
{
267-
return !Model.IsBusy && _state.IsDirty();
268-
}
269-
270266
private void EnsureRubberduckIsReferencedForEarlyBoundTests()
271267
{
272268
var projectIdsOfMembersUsingAddInLibrary = _state.DeclarationFinder.AllUserDeclarations

Rubberduck.Main/Root/RubberduckIoCInstaller.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Globalization;
4-
using System.IO;
54
using System.Linq;
65
using System.Reflection;
76
using Castle.Facilities.TypedFactory;
@@ -149,7 +148,10 @@ public void Install(IWindsorContainer container, IConfigurationStore store)
149148

150149
RegisterWindowsHooks(container);
151150

152-
RegisterHotkeyFactory(container);
151+
container.Register(Component.For<HotkeyFactory>()
152+
.LifestyleSingleton());
153+
container.Register(Component.For<ITestEngine>().ImplementedBy<TestEngine>()
154+
.LifestyleSingleton());
153155

154156
var assembliesToRegister = AssembliesToRegister().ToArray();
155157

@@ -888,10 +890,5 @@ private void RegisterConstantVbeAndAddIn(IWindsorContainer container)
888890
container.Register(Component.For<IVBEEvents>().Instance(VBEEvents.Initialize(_vbe)).LifestyleSingleton());
889891
container.Register(Component.For<ITempSourceFileHandler>().Instance(_vbe.TempSourceFileHandler));
890892
}
891-
892-
private void RegisterHotkeyFactory(IWindsorContainer container)
893-
{
894-
container.Register(Component.For<HotkeyFactory>().LifestyleSingleton());
895-
}
896893
}
897894
}

0 commit comments

Comments
 (0)