11
11
using Rubberduck . UI . SourceControl ;
12
12
using Rubberduck . VBEditor . Application ;
13
13
using Rubberduck . VBEditor . Events ;
14
+ using Rubberduck . VBEditor . SafeComWrappers ;
14
15
using Rubberduck . VBEditor . SafeComWrappers . Abstract ;
15
- using Rubberduck . VBEditor . SafeComWrappers . VBA ;
16
16
using RubberduckTests . Mocks ;
17
- using Windows = RubberduckTests . Mocks . Windows ;
18
17
19
18
namespace RubberduckTests . SourceControl
20
19
{
21
20
[ TestClass ]
22
21
public class SourceControlViewModelTests
23
22
{
24
23
private Mock < IVBE > _vbe ;
25
- private Windows _windows ;
26
- private Mock < IWindow > _window ;
24
+
27
25
#pragma warning disable 169
28
26
private object _toolWindow ;
29
27
#pragma warning restore 169
@@ -46,9 +44,12 @@ public class SourceControlViewModelTests
46
44
[ TestInitialize ]
47
45
public void InitializeMocks ( )
48
46
{
49
- _window = Mocks . MockFactory . CreateWindowMock ( ) ;
50
- _windows = new Windows ( ) { _window . Object } ;
51
- _vbe = Mocks . MockFactory . CreateVbeMock ( _windows ) ;
47
+ _vbe = new MockVbeBuilder ( )
48
+ . ProjectBuilder ( "TestProject1" , ProjectProtection . Unprotected )
49
+ . AddComponent ( "Module1" , ComponentType . StandardModule , string . Empty )
50
+ . MockVbeBuilder ( )
51
+ . Build ( ) ;
52
+
52
53
53
54
var mockHost = new Mock < IHostApplication > ( ) ;
54
55
mockHost . SetupAllProperties ( ) ;
@@ -500,7 +501,7 @@ public void OpenWorkingDir_WhenProviderCreationFails_MessageIsShown()
500
501
_folderBrowser . Setup ( b => b . ShowDialog ( ) ) . Returns ( DialogResult . OK ) ;
501
502
_folderBrowser . SetupProperty ( b => b . SelectedPath , @"C:\path\to\repo\" ) ;
502
503
503
- _providerFactory . Setup ( f => f . CreateProvider ( It . IsAny < VBProject > ( ) , It . IsAny < IRepository > ( ) ) )
504
+ _providerFactory . Setup ( f => f . CreateProvider ( It . IsAny < IVBProject > ( ) , It . IsAny < IRepository > ( ) ) )
504
505
. Throws ( new SourceControlException ( expectedTitle ,
505
506
new LibGit2Sharp . LibGit2SharpException ( expectedMessage ) )
506
507
) ;
@@ -609,7 +610,7 @@ public void UnsyncedPresenter_AfterLogin_NewPresenterIsCreatedWithCredentials()
609
610
_vm . CreateProviderWithCredentials ( new SecureCredentials ( username , password ) ) ;
610
611
611
612
//assert
612
- _providerFactory . Verify ( f => f . CreateProvider ( It . IsAny < VBProject > ( ) , It . IsAny < IRepository > ( ) , It . IsAny < SecureCredentials > ( ) ) ) ;
613
+ _providerFactory . Verify ( f => f . CreateProvider ( It . IsAny < IVBProject > ( ) , It . IsAny < IRepository > ( ) , It . IsAny < SecureCredentials > ( ) ) ) ;
613
614
}
614
615
615
616
[ TestMethod ]
@@ -929,7 +930,7 @@ public void OpenDirAssignedToRepo_WhenProviderCreationFails_MessageIsShown()
929
930
_folderBrowser . Setup ( b => b . ShowDialog ( ) ) . Returns ( DialogResult . OK ) ;
930
931
_folderBrowser . SetupProperty ( b => b . SelectedPath , @"C:\path\to\repo\" ) ;
931
932
932
- _providerFactory . Setup ( f => f . CreateProvider ( It . IsAny < VBProject > ( ) , It . IsAny < IRepository > ( ) ) )
933
+ _providerFactory . Setup ( f => f . CreateProvider ( It . IsAny < IVBProject > ( ) , It . IsAny < IRepository > ( ) ) )
933
934
. Throws ( new SourceControlException ( expectedTitle ,
934
935
new LibGit2Sharp . LibGit2SharpException ( expectedMessage ) )
935
936
) ;
0 commit comments