@@ -37,8 +37,6 @@ public class UnintrusiveBindingControllerTests
37
37
private static readonly UsernameAndPasswordCredentials ValidToken = new ( "TOKEN" , new SecureString ( ) ) ;
38
38
private static readonly BoundServerProject AnyBoundProject = new ( "any" , "any" , new ServerConnection . SonarCloud ( "any" , credentials : ValidToken ) ) ;
39
39
private IActiveSolutionChangedHandler activeSolutionChangedHandler ;
40
- private IBindingProcess bindingProcess ;
41
- private IBindingProcessFactory bindingProcessFactory ;
42
40
private ISonarQubeService sonarQubeService ;
43
41
private UnintrusiveBindingController testSubject ;
44
42
private ISolutionBindingRepository solutionBindingRepository ;
@@ -47,31 +45,19 @@ public class UnintrusiveBindingControllerTests
47
45
[ TestInitialize ]
48
46
public void TestInitialize ( )
49
47
{
50
- CreateBindingProcessFactory ( ) ;
51
48
sonarQubeService = Substitute . For < ISonarQubeService > ( ) ;
52
49
activeSolutionChangedHandler = Substitute . For < IActiveSolutionChangedHandler > ( ) ;
53
50
solutionBindingRepository = Substitute . For < ISolutionBindingRepository > ( ) ;
54
51
configurationPersister = Substitute . For < IConfigurationPersister > ( ) ;
55
- testSubject = new UnintrusiveBindingController ( bindingProcessFactory , sonarQubeService , activeSolutionChangedHandler , solutionBindingRepository , configurationPersister ) ;
52
+ testSubject = new UnintrusiveBindingController ( sonarQubeService , activeSolutionChangedHandler , solutionBindingRepository , configurationPersister ) ;
56
53
}
57
54
58
55
[ TestMethod ]
59
56
public void MefCtor_CheckTypeIsNonShared ( ) => MefTestHelpers . CheckIsNonSharedMefComponent < UnintrusiveBindingController > ( ) ;
60
57
61
- [ TestMethod ]
62
- public void MefCtor_IUnintrusiveBindingController_CheckIsExported ( ) =>
63
- MefTestHelpers . CheckTypeCanBeImported < UnintrusiveBindingController , IUnintrusiveBindingController > (
64
- MefTestHelpers . CreateExport < IBindingProcessFactory > ( ) ,
65
- MefTestHelpers . CreateExport < ISonarQubeService > ( ) ,
66
- MefTestHelpers . CreateExport < IActiveSolutionChangedHandler > ( ) ,
67
- MefTestHelpers . CreateExport < ISolutionBindingRepository > ( ) ,
68
- MefTestHelpers . CreateExport < IConfigurationPersister > ( )
69
- ) ;
70
-
71
58
[ TestMethod ]
72
59
public void MefCtor_IBindingController_CheckIsExported ( ) =>
73
60
MefTestHelpers . CheckTypeCanBeImported < UnintrusiveBindingController , IBindingController > (
74
- MefTestHelpers . CreateExport < IBindingProcessFactory > ( ) ,
75
61
MefTestHelpers . CreateExport < ISonarQubeService > ( ) ,
76
62
MefTestHelpers . CreateExport < IActiveSolutionChangedHandler > ( ) ,
77
63
MefTestHelpers . CreateExport < ISolutionBindingRepository > ( ) ,
@@ -108,18 +94,13 @@ public async Task BindAsync_NotifiesBindingChanged()
108
94
}
109
95
110
96
[ TestMethod ]
111
- public async Task BindAsync_CallsBindingProcessInOrder ( )
97
+ public async Task BindAsync_PersistsBindingInformation ( )
112
98
{
113
99
var cancellationToken = CancellationToken . None ;
114
100
115
- await testSubject . BindAsync ( AnyBoundProject , null , cancellationToken ) ;
101
+ await testSubject . BindAsync ( AnyBoundProject , cancellationToken ) ;
116
102
117
- Received . InOrder ( ( ) =>
118
- {
119
- bindingProcessFactory . Create ( Arg . Is < BindCommandArgs > ( b => b . ProjectToBind == AnyBoundProject ) ) ;
120
- bindingProcess . DownloadQualityProfileAsync ( null , cancellationToken ) ;
121
- configurationPersister . Persist ( AnyBoundProject ) ;
122
- } ) ;
103
+ configurationPersister . Received ( 1 ) . Persist ( AnyBoundProject ) ;
123
104
}
124
105
125
106
[ TestMethod ]
@@ -159,12 +140,4 @@ public void Unbind_ReturnsResultOfDeletedBinding(bool expectedResult)
159
140
160
141
result . Should ( ) . Be ( expectedResult ) ;
161
142
}
162
-
163
- private void CreateBindingProcessFactory ( )
164
- {
165
- bindingProcess ??= Substitute . For < IBindingProcess > ( ) ;
166
-
167
- bindingProcessFactory = Substitute . For < IBindingProcessFactory > ( ) ;
168
- bindingProcessFactory . Create ( Arg . Any < BindCommandArgs > ( ) ) . Returns ( bindingProcess ) ;
169
- }
170
143
}
0 commit comments