Skip to content

Commit 933e275

Browse files
committed
Refactor test setup for interface changes.
1 parent 3c804dd commit 933e275

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

RubberduckTests/CodeExplorer/MockedCodeExplorer.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
using Rubberduck.Interaction;
2121
using Rubberduck.UI.UnitTesting.Commands;
2222
using Rubberduck.UnitTesting;
23+
using Rubberduck.UnitTesting.CodeGeneration;
24+
using Rubberduck.UnitTesting.Settings;
25+
using RubberduckTests.Settings;
2326

2427
namespace RubberduckTests.CodeExplorer
2528
{
@@ -30,6 +33,7 @@ internal class MockedCodeExplorer : IDisposable
3033
private readonly Mock<IUiDispatcher> _uiDispatcher = new Mock<IUiDispatcher>();
3134
private readonly Mock<IConfigProvider<GeneralSettings>> _generalSettingsProvider = new Mock<IConfigProvider<GeneralSettings>>();
3235
private readonly Mock<IConfigProvider<WindowSettings>> _windowSettingsProvider = new Mock<IConfigProvider<WindowSettings>>();
36+
private readonly Mock<IConfigProvider<UnitTestSettings>> _unitTestSettingsProvider = new Mock<IConfigProvider<UnitTestSettings>>();
3337
private readonly Mock<ConfigurationLoader> _configLoader = new Mock<ConfigurationLoader>(null, null, null, null, null, null, null, null);
3438
private readonly Mock<IVBEInteraction> _interaction = new Mock<IVBEInteraction>();
3539

@@ -38,6 +42,8 @@ public MockedCodeExplorer()
3842
_generalSettingsProvider.Setup(s => s.Create()).Returns(_generalSettings);
3943
_windowSettingsProvider.Setup(s => s.Create()).Returns(WindowSettings);
4044
_configLoader.Setup(c => c.LoadConfiguration()).Returns(GetDefaultUnitTestConfig());
45+
_unitTestSettingsProvider.Setup(s => s.Create())
46+
.Returns(new UnitTestSettings(BindingMode.LateBinding,AssertMode.StrictAssert, true, true, false));
4147

4248
_uiDispatcher.Setup(m => m.Invoke(It.IsAny<Action>())).Callback((Action argument) => argument.Invoke());
4349

@@ -271,7 +277,9 @@ public void ExecuteAddUserDocumentCommand()
271277

272278
public MockedCodeExplorer ImplementAddTestModuleCommand()
273279
{
274-
ViewModel.AddTestModuleCommand = new AddTestComponentCommand(Vbe.Object, State, _configLoader.Object, MessageBox.Object, _interaction.Object);
280+
var indenter = new Indenter(null, () => IndenterSettingsTests.GetMockIndenterSettings());
281+
var codeGenerator = new TestCodeGenerator(Vbe.Object, State, MessageBox.Object, _interaction.Object, _unitTestSettingsProvider.Object, indenter);
282+
ViewModel.AddTestModuleCommand = new AddTestComponentCommand(Vbe.Object, State, codeGenerator);
275283
return this;
276284
}
277285

@@ -362,7 +370,7 @@ public void ExecuteIndenterCommand()
362370

363371
public MockedCodeExplorer ImplementIndenterCommand()
364372
{
365-
ViewModel.IndenterCommand = new IndentCommand(State, new Indenter(Vbe.Object, () => Settings.IndenterSettingsTests.GetMockIndenterSettings()), null);
373+
ViewModel.IndenterCommand = new IndentCommand(State, new Indenter(Vbe.Object, () => IndenterSettingsTests.GetMockIndenterSettings()), null);
366374
return this;
367375
}
368376

RubberduckTests/Settings/UnitTestSettingsTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
using NUnit.Framework;
22
using Rubberduck.Settings;
33
using Rubberduck.UI.Settings;
4-
using UnitTestSettings = Rubberduck.Settings.UnitTestSettings;
4+
using Rubberduck.UnitTesting.Settings;
5+
using UnitTestSettings = Rubberduck.UnitTesting.Settings.UnitTestSettings;
56

67
namespace RubberduckTests.Settings
78
{

0 commit comments

Comments
 (0)