@@ -17,8 +17,6 @@ namespace RubberduckTests.Mocks
17
17
[ SuppressMessage ( "Microsoft.Design" , "CA1001" ) ] //CA1001 is complaining about RubberduckTests.Mocks.Windows, which doesn't need to be disposed in this context.
18
18
public class MockVbeBuilder
19
19
{
20
- //provide ability for inspection tests to modify the default
21
- //Project and Module names (e.g., the defaults are flagged by MeaninglessName inspection)
22
20
public static string TestProjectName { set ; get ; } = "TestProject1" ;
23
21
public static string TestModuleName { set ; get ; } = "TestModule1" ;
24
22
private readonly Mock < IVBE > _vbe ;
@@ -56,12 +54,13 @@ public class MockVbeBuilder
56
54
[ "ADOR" ] = LibraryPathAdoRecordset
57
55
} ;
58
56
59
- private static readonly Dictionary < string , Action < MockProjectBuilder > > addLibraryRefActions = new Dictionary < string , Action < MockProjectBuilder > >
57
+ private static readonly Dictionary < string , Action < MockProjectBuilder > > addReferenceActions = new Dictionary < string , Action < MockProjectBuilder > >
60
58
{
61
59
[ "Excel" ] = ( MockProjectBuilder builder ) => builder . AddReference ( "Excel" , LibraryPathMsExcel , 1 , 8 , true ) ,
62
60
[ "VBA" ] = ( MockProjectBuilder builder ) => builder . AddReference ( "VBA" , LibraryPathVBA , 4 , 2 , true ) ,
63
61
[ "Scripting" ] = ( MockProjectBuilder builder ) => builder . AddReference ( "Scripting" , LibraryPathScripting , 1 , 0 , true ) ,
64
62
[ "ADODB" ] = ( MockProjectBuilder builder ) => builder . AddReference ( "ADODB" , LibraryPathAdoDb , 6 , 1 , false ) ,
63
+ [ "MSForms" ] = ( MockProjectBuilder builder ) => builder . AddReference ( "MSForms" , LibraryPathMsForms , 2 , 0 , true ) ,
65
64
} ;
66
65
67
66
//private Mock<IWindows> _vbWindows;
@@ -218,18 +217,16 @@ public static Mock<IVBE> BuildFromModules(IEnumerable<(string name, string conte
218
217
}
219
218
220
219
/// <summary>
221
- /// Builds a mock VBE containing one project with multiple modules .
220
+ /// Builds a mock VBE containing one project with one module and one library .
222
221
/// </summary>
223
- public static Mock < IVBE > BuildFromModules ( IEnumerable < Action < MockProjectBuilder > > AddReferenceLibraryActions , params ( string name , string content , ComponentType componentType ) [ ] modules )
224
- {
225
- return BuildFromModules ( ( IEnumerable < ( string name , string content , ComponentType componentType ) > ) modules ) ;
226
- }
222
+ public static Mock < IVBE > BuildFromModules ( ( string name , string content , ComponentType componentType ) module , string library )
223
+ => BuildFromModules ( new ( string , string , ComponentType ) [ ] { module } , new string [ ] { library } ) ;
227
224
228
225
/// <summary>
229
- /// Builds a mock VBE containing one project with one module and one library .
226
+ /// Builds a mock VBE containing one project with one module and multiple libraries .
230
227
/// </summary>
231
- public static Mock < IVBE > BuildFromModules ( ( string name , string content , ComponentType componentType ) module , string library )
232
- => BuildFromModules ( new ( string , string , ComponentType ) [ ] { module } , new string [ ] { library } ) ;
228
+ public static Mock < IVBE > BuildFromModules ( ( string name , string content , ComponentType componentType ) module , IEnumerable < string > libraries )
229
+ => BuildFromModules ( new ( string , string , ComponentType ) [ ] { module } , libraries ) ;
233
230
234
231
/// <summary>
235
232
/// Builds a mock VBE containing one project with one or more modules using one or more libraries.
@@ -246,7 +243,7 @@ public static Mock<IVBE> BuildFromModules(IEnumerable<(string name, string conte
246
243
247
244
foreach ( var name in libraryNames )
248
245
{
249
- addLibraryRefActions [ name ] ( builder ) ;
246
+ addReferenceActions [ name ] ( builder ) ;
250
247
}
251
248
252
249
var project = builder . Build ( ) ;
0 commit comments