Skip to content

Commit 3c804dd

Browse files
committed
Address review comments.
1 parent ccd51b1 commit 3c804dd

File tree

7 files changed

+17
-12
lines changed

7 files changed

+17
-12
lines changed

Rubberduck.Core/UI/CodeExplorer/Commands/AddTestComponentCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using Rubberduck.Navigation.CodeExplorer;
55
using Rubberduck.Parsing.VBA;
66
using Rubberduck.UI.UnitTesting.Commands;
7-
using Rubberduck.UnitTesting.UnitTesting;
7+
using Rubberduck.UnitTesting.CodeGeneration;
88
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
99

1010
namespace Rubberduck.UI.CodeExplorer.Commands

Rubberduck.Core/UI/UnitTesting/Commands/AddTestMethodCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Rubberduck.Parsing.VBA;
77
using Rubberduck.UI.Command;
88
using Rubberduck.UnitTesting;
9-
using Rubberduck.UnitTesting.UnitTesting;
9+
using Rubberduck.UnitTesting.CodeGeneration;
1010
using Rubberduck.VBEditor.Extensions;
1111
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1212

Rubberduck.Core/UI/UnitTesting/Commands/AddTestMethodExpectedErrorCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Rubberduck.Parsing.VBA;
77
using Rubberduck.UI.Command;
88
using Rubberduck.UnitTesting;
9-
using Rubberduck.UnitTesting.UnitTesting;
9+
using Rubberduck.UnitTesting.CodeGeneration;
1010
using Rubberduck.VBEditor.Extensions;
1111
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1212

Rubberduck.Core/UI/UnitTesting/Commands/AddTestModuleCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
66
using Rubberduck.Parsing.Symbols;
77
using Rubberduck.UI.Command;
8-
using Rubberduck.UnitTesting.UnitTesting;
8+
using Rubberduck.UnitTesting.CodeGeneration;
99

1010
namespace Rubberduck.UI.UnitTesting.Commands
1111
{

Rubberduck.UnitTesting/UnitTesting/ITestCodeGenerator.cs renamed to Rubberduck.UnitTesting/CodeGeneration/ITestCodeGenerator.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System.Collections.Generic;
2-
using Rubberduck.Parsing.Symbols;
1+
using Rubberduck.Parsing.Symbols;
32
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
43

5-
namespace Rubberduck.UnitTesting.UnitTesting
4+
namespace Rubberduck.UnitTesting.CodeGeneration
65
{
76
public interface ITestCodeGenerator
87
{

Rubberduck.UnitTesting/UnitTesting/TestCodeGenerator.cs renamed to Rubberduck.UnitTesting/CodeGeneration/TestCodeGenerator.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using Rubberduck.VBEditor.SafeComWrappers;
1313
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
1414

15-
namespace Rubberduck.UnitTesting.UnitTesting
15+
namespace Rubberduck.UnitTesting.CodeGeneration
1616
{
1717
public partial class TestCodeGenerator : ITestCodeGenerator
1818
{
@@ -56,7 +56,6 @@ private void AddTestModule(IVBProject project, Declaration stubSource)
5656

5757
if (settings.BindingMode == BindingMode.EarlyBinding)
5858
{
59-
// FIXME: Push the actual adding of TestModules into UnitTesting, which sidesteps VBEInteraction being inaccessble here
6059
_interaction.EnsureProjectReferencesUnitTesting(project);
6160
}
6261

@@ -115,7 +114,9 @@ private string GetNewTestModuleCode(IVBComponent component, List<Declaration> st
115114
return GetNewTestModuleCode(component);
116115
}
117116

118-
var module = string.Join(Environment.NewLine + Environment.NewLine, new [] { GetBaseTestModule() }.Concat(stubs.Select(GetNewTestStubMethod)));
117+
var baseCode = GetBaseTestModule();
118+
var stubMethods = stubs.Select(GetNewTestStubMethod);
119+
var module = string.Join(Environment.NewLine + Environment.NewLine, new [] { baseCode }.Concat(stubMethods));
119120

120121
return string.Join(Environment.NewLine, _indenter.Indent(module));
121122
}
@@ -129,7 +130,7 @@ private string GetBaseTestModule(UnitTestSettings settings = null)
129130

130131
string declaration;
131132
string initialization;
132-
var asserts = settings.AssertMode == AssertMode.PermissiveAssert ? "PermissiveAssertClass" : "AssertClass";
133+
var asserts = settings.AssertMode == AssertMode.PermissiveAssert ? PermissiveAssertClassName : AssertClassName;
133134

134135
switch (settings.BindingMode)
135136
{

Rubberduck.UnitTesting/UnitTesting/TestCodeGeneratorStatics.cs renamed to Rubberduck.UnitTesting/CodeGeneration/TestCodeGeneratorStatics.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
using System;
22
using Rubberduck.Resources.UnitTesting;
33

4-
namespace Rubberduck.UnitTesting.UnitTesting
4+
namespace Rubberduck.UnitTesting.CodeGeneration
55
{
66
public partial class TestCodeGenerator
77
{
8+
// These have to match the names of the exposed classes on the RD interface. They're only public here to facilitate a unit test that
9+
// ensures this (and hey - they're constants so it's not hurting anything, right?).
10+
public const string AssertClassName = "AssertClass";
11+
public const string PermissiveAssertClassName = "PermissiveAssertClass";
12+
813
private static string TestModuleBaseName => TestExplorer.UnitTest_NewModule_BaseName;
914
private static string TestMethodBaseName => TestExplorer.UnitTest_NewMethod_BaseName;
1015

0 commit comments

Comments
 (0)