55using System . Linq ;
66using Rubberduck . Parsing ;
77using Rubberduck . Parsing . Symbols ;
8+ using Rubberduck . Parsing . VBA ;
89using Rubberduck . UI ;
910using Rubberduck . UI . Controls ;
1011using 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
0 commit comments