@@ -1814,7 +1814,6 @@ public void RenameRefactoring_RefactorProperties_UpdatesReferences()
1814
1814
var oldName = "Column" ;
1815
1815
var refactoredName = "Rank" ;
1816
1816
1817
- var tdo = new RenameTestsDataObject ( oldName , refactoredName ) ;
1818
1817
var classInputOutput = new RenameTestModuleDefinition ( "MyClass" , ComponentType . ClassModule )
1819
1818
{
1820
1819
Input = $@ "Option Explicit
@@ -1824,7 +1823,7 @@ Private colValue As Long
1824
1823
Public Property Get { oldName } () As Long
1825
1824
{ oldName } = colValue
1826
1825
End Property
1827
- Public Property Let | { oldName } (value As Long)
1826
+ Public Property Let { FAUX_CURSOR } { oldName } (value As Long)
1828
1827
colValue = value
1829
1828
End Property
1830
1829
" ,
@@ -1850,7 +1849,8 @@ Dim instance As MyClass
1850
1849
instance.{ oldName } = 97521
1851
1850
Debug.Print instance.{ oldName } ;""is the value""
1852
1851
End Sub
1853
- " , Expected = $@ "Option Explicit
1852
+ " ,
1853
+ Expected = $@ "Option Explicit
1854
1854
1855
1855
Public Sub useColValue()
1856
1856
Dim instance As MyClass
@@ -1860,8 +1860,24 @@ Dim instance As MyClass
1860
1860
End Sub
1861
1861
"
1862
1862
} ;
1863
- tdo . RefactorParamType = RefactorParams . Declaration ;
1864
- PerformExpectedVersusActualRenameTests ( tdo , classInputOutput , usageInputOutput ) ;
1863
+
1864
+ var builder = new MockVbeBuilder ( ) ;
1865
+ var projectName = "Test" ;
1866
+ var vbe = builder . ProjectBuilder ( projectName , ProjectProtection . Unprotected )
1867
+ . AddReference ( "VBA" , MockVbeBuilder . LibraryPathVBA , major : 4 , minor : 1 , isBuiltIn : true )
1868
+ . AddComponent ( "MyClass" , ComponentType . ClassModule , classInputOutput . Input . Replace ( FAUX_CURSOR , "" ) )
1869
+ . AddComponent ( "Usage" , ComponentType . StandardModule , usageInputOutput . Input )
1870
+ . AddProjectToVbeBuilder ( )
1871
+ . Build ( ) ;
1872
+
1873
+ var tdo = new RenameTestsDataObject ( oldName , refactoredName )
1874
+ {
1875
+ VBE = vbe . Object ,
1876
+ RefactorParamType = RefactorParams . Declaration ,
1877
+ SelectionModuleName = "MyClass" ,
1878
+ ProjectName = projectName
1879
+ } ;
1880
+ PerformExpectedVersusActualRenameTests ( tdo , classInputOutput , usageInputOutput , testLibraries : new [ ] { "VBA.4.2.xml" } ) ;
1865
1881
tdo . MsgBox . Verify ( m => m . Show ( It . IsAny < string > ( ) , It . IsAny < string > ( ) , It . IsAny < MessageBoxButtons > ( ) , It . IsAny < MessageBoxIcon > ( ) ) , Times . Never ) ;
1866
1882
}
1867
1883
#endregion
@@ -2085,11 +2101,12 @@ private static void PerformExpectedVersusActualRenameTests(RenameTestsDataObject
2085
2101
, RenameTestModuleDefinition ? inputOutput1
2086
2102
, RenameTestModuleDefinition ? inputOutput2 = null
2087
2103
, RenameTestModuleDefinition ? inputOutput3 = null
2088
- , RenameTestModuleDefinition ? inputOutput4 = null )
2104
+ , RenameTestModuleDefinition ? inputOutput4 = null
2105
+ , IEnumerable < string > testLibraries = null )
2089
2106
{
2090
2107
try
2091
2108
{
2092
- InitializeTestDataObject ( tdo , inputOutput1 , inputOutput2 , inputOutput3 , inputOutput4 ) ;
2109
+ InitializeTestDataObject ( tdo , inputOutput1 , inputOutput2 , inputOutput3 , inputOutput4 , testLibraries ) ;
2093
2110
RunRenameRefactorScenario ( tdo ) ;
2094
2111
CheckRenameRefactorTestResults ( tdo ) ;
2095
2112
}
@@ -2103,7 +2120,8 @@ private static void InitializeTestDataObject(RenameTestsDataObject tdo
2103
2120
, RenameTestModuleDefinition ? inputOutput1
2104
2121
, RenameTestModuleDefinition ? inputOutput2 = null
2105
2122
, RenameTestModuleDefinition ? inputOutput3 = null
2106
- , RenameTestModuleDefinition ? inputOutput4 = null )
2123
+ , RenameTestModuleDefinition ? inputOutput4 = null
2124
+ , IEnumerable < string > testLibraries = null )
2107
2125
{
2108
2126
var renameTMDs = new List < RenameTestModuleDefinition > ( ) ;
2109
2127
bool cursorFound = false ;
@@ -2144,7 +2162,7 @@ private static void InitializeTestDataObject(RenameTestsDataObject tdo
2144
2162
. Returns ( tdo . MsgBoxReturn ) ;
2145
2163
2146
2164
tdo . VBE = tdo . VBE ?? BuildProject ( tdo . ProjectName , tdo . ModuleTestSetupDefs ) ;
2147
- tdo . ParserState = MockParser . CreateAndParse ( tdo . VBE ) ;
2165
+ tdo . ParserState = MockParser . CreateAndParse ( tdo . VBE , testLibraries : testLibraries ) ;
2148
2166
2149
2167
CreateQualifiedSelectionForTestCase ( tdo ) ;
2150
2168
tdo . RenameModel = new RenameModel ( tdo . VBE , tdo . ParserState , tdo . QualifiedSelection ) { NewName = tdo . NewName } ;
@@ -2269,7 +2287,6 @@ private static IVBE BuildProject(string projectName, List<RenameTestModuleDefini
2269
2287
{
2270
2288
var builder = new MockVbeBuilder ( ) ;
2271
2289
var enclosingProjectBuilder = builder . ProjectBuilder ( projectName , ProjectProtection . Unprotected ) ;
2272
-
2273
2290
foreach ( var comp in testComponents )
2274
2291
{
2275
2292
if ( comp . ModuleType == ComponentType . UserForm )
0 commit comments