22{
33 using System . Collections . Generic ;
44 using System . Threading . Tasks ;
5- using DigitalLearningSolutions . Data . DataServices ;
6- using DigitalLearningSolutions . Data . DataServices . UserDataService ;
75 using DigitalLearningSolutions . Data . Enums ;
86 using DigitalLearningSolutions . Data . Exceptions ;
97 using DigitalLearningSolutions . Data . Models . Register ;
@@ -28,27 +26,25 @@ public class RegisterControllerTests
2826 {
2927 private const string IpAddress = "1.1.1.1" ;
3028 private const int SupervisorDelegateId = 1 ;
31- private ICentresDataService centresDataService = null ! ;
29+ private ICentresService centresService = null ! ;
3230 private RegisterController controller = null ! ;
3331 private ICryptoService cryptoService = null ! ;
3432 private IFeatureManager featureManager = null ! ;
35- private IJobGroupsDataService jobGroupsDataService = null ! ;
33+ private IJobGroupsService jobGroupsService = null ! ;
3634 private PromptsService promptsService = null ! ;
3735 private IRegistrationService registrationService = null ! ;
3836 private HttpRequest request = null ! ;
3937 private ISupervisorDelegateService supervisorDelegateService = null ! ;
40- private IUserDataService userDataService = null ! ;
4138 private IUserService userService = null ! ;
4239 private ISupervisorService supervisorService = null ! ;
4340
4441 [ SetUp ]
4542 public void Setup ( )
4643 {
47- centresDataService = A . Fake < ICentresDataService > ( ) ;
44+ centresService = A . Fake < ICentresService > ( ) ;
4845 cryptoService = A . Fake < ICryptoService > ( ) ;
49- jobGroupsDataService = A . Fake < IJobGroupsDataService > ( ) ;
46+ jobGroupsService = A . Fake < IJobGroupsService > ( ) ;
5047 registrationService = A . Fake < IRegistrationService > ( ) ;
51- userDataService = A . Fake < IUserDataService > ( ) ;
5248 userService = A . Fake < IUserService > ( ) ;
5349 promptsService = A . Fake < PromptsService > ( ) ;
5450 featureManager = A . Fake < IFeatureManager > ( ) ;
@@ -57,14 +53,13 @@ public void Setup()
5753 request = A . Fake < HttpRequest > ( ) ;
5854
5955 controller = new RegisterController (
60- centresDataService ,
61- jobGroupsDataService ,
56+ centresService ,
57+ jobGroupsService ,
6258 registrationService ,
6359 cryptoService ,
6460 promptsService ,
6561 featureManager ,
6662 supervisorDelegateService ,
67- userDataService ,
6863 userService ,
6964 supervisorService
7065 )
@@ -104,7 +99,7 @@ public void IndexGet_with_no_centreId_shows_index_page()
10499 var result = controller . Index ( ) ;
105100
106101 // Then
107- A . CallTo ( ( ) => centresDataService . GetCentreName ( A < int > . _ ) ) . MustNotHaveHappened ( ) ;
102+ A . CallTo ( ( ) => centresService . GetCentreName ( A < int > . _ ) ) . MustNotHaveHappened ( ) ;
108103
109104 using ( new AssertionScope ( ) )
110105 {
@@ -120,7 +115,7 @@ public void IndexGet_with_centreId_shows_index_page()
120115 const int centreId = 1 ;
121116 const string centreName = "centre" ;
122117 const string inviteId = "invite" ;
123- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . Returns ( centreName ) ;
118+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . Returns ( centreName ) ;
124119
125120 // When
126121 var result = controller . Index ( centreId , inviteId ) ;
@@ -139,13 +134,13 @@ public void IndexGet_with_invalid_centreId_param_shows_error()
139134 {
140135 // Given
141136 const int centreId = 7 ;
142- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . Returns ( null ) ;
137+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . Returns ( null ) ;
143138
144139 // When
145140 var result = controller . Index ( centreId ) ;
146141
147142 // Then
148- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
143+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
149144 result . Should ( ) . BeNotFoundResult ( ) ;
150145 }
151146
@@ -156,14 +151,13 @@ public void IndexGet_while_logged_in_redirects_to_register_at_new_centre_journey
156151 const int centreId = 1 ;
157152 const string inviteId = "invite" ;
158153 var authenticatedController = new RegisterController (
159- centresDataService ,
160- jobGroupsDataService ,
154+ centresService ,
155+ jobGroupsService ,
161156 registrationService ,
162157 cryptoService ,
163158 promptsService ,
164159 featureManager ,
165160 supervisorDelegateService ,
166- userDataService ,
167161 userService ,
168162 supervisorService
169163 ) . WithDefaultContext ( ) . WithMockUser ( true ) ;
@@ -181,13 +175,13 @@ public void Start_with_invalid_centreId_param_shows_error()
181175 {
182176 // Given
183177 const int centreId = 7 ;
184- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . Returns ( null ) ;
178+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . Returns ( null ) ;
185179
186180 // When
187181 var result = controller . Start ( centreId ) ;
188182
189183 // Then
190- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
184+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
191185 result . Should ( ) . BeNotFoundResult ( ) ;
192186 }
193187
@@ -196,13 +190,13 @@ public void Start_with_valid_centreId_param_sets_data_correctly()
196190 {
197191 // Given
198192 const int centreId = 7 ;
199- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . Returns ( "Some centre" ) ;
193+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . Returns ( "Some centre" ) ;
200194
201195 // When
202196 var result = controller . Start ( centreId ) ;
203197
204198 // Then
205- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
199+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . MustHaveHappened ( 1 , Times . Exactly ) ;
206200 var data = controller . TempData . Peek < DelegateRegistrationData > ( ) ! ;
207201 data . Centre . Should ( ) . Be ( centreId ) ;
208202 data . IsCentreSpecificRegistration . Should ( ) . BeTrue ( ) ;
@@ -216,7 +210,7 @@ public void Start_with_no_centreId_param_allows_normal_registration()
216210 var result = controller . Start ( ) ;
217211
218212 // Then
219- A . CallTo ( ( ) => centresDataService . GetCentreName ( A < int > . _ ) ) . MustNotHaveHappened ( ) ;
213+ A . CallTo ( ( ) => centresService . GetCentreName ( A < int > . _ ) ) . MustNotHaveHappened ( ) ;
220214 var data = controller . TempData . Peek < DelegateRegistrationData > ( ) ! ;
221215 data . Centre . Should ( ) . BeNull ( ) ;
222216 data . IsCentreSpecificRegistration . Should ( ) . BeFalse ( ) ;
@@ -231,19 +225,18 @@ public void Start_while_logged_in_redirects_to_register_at_new_centre_journey()
231225 const string centreName = "centre" ;
232226 const string inviteId = "invite" ;
233227 var authenticatedController = new RegisterController (
234- centresDataService ,
235- jobGroupsDataService ,
228+ centresService ,
229+ jobGroupsService ,
236230 registrationService ,
237231 cryptoService ,
238232 promptsService ,
239233 featureManager ,
240234 supervisorDelegateService ,
241- userDataService ,
242235 userService ,
243236 supervisorService
244237 ) . WithDefaultContext ( ) . WithMockUser ( true ) ;
245238
246- A . CallTo ( ( ) => centresDataService . GetCentreName ( centreId ) ) . Returns ( centreName ) ;
239+ A . CallTo ( ( ) => centresService . GetCentreName ( centreId ) ) . Returns ( centreName ) ;
247240
248241 // When
249242 var result = authenticatedController . Start ( centreId , inviteId ) ;
@@ -502,7 +495,7 @@ int userId
502495 ) ;
503496
504497 A . CallTo (
505- ( ) => userDataService . GetUserIdFromUsername ( candidateNumber )
498+ ( ) => userService . GetUserIdFromUsername ( candidateNumber )
506499 )
507500 . Returns ( userId ) ;
508501 }
0 commit comments