Skip to content

Commit 3eba41e

Browse files
changed the overload used of ExecuteCode to pass IVBProject rather than the project name.
1 parent a792821 commit 3eba41e

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Rubberduck.Core/UnitTesting/TestMethod.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using Rubberduck.Parsing;
77
using Rubberduck.Parsing.Symbols;
8+
using Rubberduck.Parsing.VBA;
89
using Rubberduck.UI;
910
using Rubberduck.UI.Controls;
1011
using Rubberduck.VBEditor;
@@ -19,12 +20,14 @@ public class TestMethod : ViewModelBase, IEquatable<TestMethod>, INavigateSource
1920
private readonly ICollection<AssertCompletedEventArgs> _assertResults = new List<AssertCompletedEventArgs>();
2021
private readonly IVBE _vbe;
2122
private readonly IVBETypeLibsAPI _typeLibApi;
23+
private readonly RubberduckParserState _state;
2224

23-
public TestMethod(Declaration declaration, IVBE vbe, IVBETypeLibsAPI typeLibApi)
25+
public TestMethod(Declaration declaration, IVBE vbe, IVBETypeLibsAPI typeLibApi, RubberduckParserState state)
2426
{
2527
_declaration = declaration;
2628
_vbe = vbe;
2729
_typeLibApi = typeLibApi;
30+
_state = state;
2831
}
2932

3033
private Declaration _declaration;
@@ -46,7 +49,8 @@ public void Run()
4649
try
4750
{
4851
AssertHandler.OnAssertCompleted += HandleAssertCompleted;
49-
_typeLibApi.ExecuteCode(_vbe, Declaration.ProjectName, Declaration.QualifiedModuleName.ComponentName,
52+
var project = _state.ProjectsProvider.Project(Declaration.ProjectId);
53+
_typeLibApi.ExecuteCode(project, Declaration.QualifiedModuleName.ComponentName,
5054
Declaration.QualifiedName.MemberName);
5155
AssertHandler.OnAssertCompleted -= HandleAssertCompleted;
5256

Rubberduck.Core/UnitTesting/UnitTestUtils.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static IEnumerable<TestMethod> GetAllTests(IVBE vbe, RubberduckParserStat
1717
{
1818
return GetTestModuleProcedures(state)
1919
.Where(item => IsTestMethod(state, item))
20-
.Select(item => new TestMethod(item, vbe, new VBETypeLibsAPI()));
20+
.Select(item => new TestMethod(item, vbe, new VBETypeLibsAPI(), state));
2121
}
2222

2323
public static IEnumerable<TestMethod> GetTests(this IVBComponent component, IVBE vbe, RubberduckParserState state)

0 commit comments

Comments
 (0)