Skip to content

Commit 6a2ea75

Browse files
committed
Refactored some duplicate code
1 parent f9de83c commit 6a2ea75

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

RubberduckTests/Mocks/MockVbeBuilder.cs

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -196,25 +196,7 @@ public static Mock<IVBE> BuildFromModules(params (string name, string content, C
196196
/// Builds a mock VBE containing one project with multiple modules.
197197
/// </summary>
198198
public static Mock<IVBE> BuildFromModules(IEnumerable<(string name, string content, ComponentType componentType)> modules)
199-
{
200-
var vbeBuilder = new MockVbeBuilder();
201-
202-
var builder = vbeBuilder.ProjectBuilder(TestProjectName, ProjectProtection.Unprotected);
203-
foreach (var (name, content, componentType) in modules)
204-
{
205-
builder.AddComponent(name, componentType, content);
206-
}
207-
208-
var project = builder.Build();
209-
var vbe = vbeBuilder.AddProject(project).Build();
210-
211-
var component = project.Object.VBComponents[0];
212-
213-
vbe.Object.ActiveVBProject = project.Object;
214-
vbe.Object.ActiveCodePane = component.CodeModule.CodePane;
215-
216-
return vbe;
217-
}
199+
=> BuildFromModules(modules, Enumerable.Empty<string>());
218200

219201
/// <summary>
220202
/// Builds a mock VBE containing one project with one module and one library.
@@ -229,7 +211,7 @@ public static Mock<IVBE> BuildFromModules((string name, string content, Componen
229211
=> BuildFromModules(new(string, string, ComponentType)[] { module }, libraries);
230212

231213
/// <summary>
232-
/// Builds a mock VBE containing one project with one or more modules using one or more libraries.
214+
/// Builds a mock VBE containing one project with multiple modules and libraries.
233215
/// </summary>
234216
public static Mock<IVBE> BuildFromModules(IEnumerable<(string name, string content, ComponentType componentType)> modules, IEnumerable<string> libraryNames)
235217
{

0 commit comments

Comments
 (0)