@@ -34,7 +34,7 @@ public class AccountsControllerTests : IDisposable
3434 private readonly IUserService _userService ;
3535 private readonly IProviderUserRepository _providerUserRepository ;
3636 private readonly IPolicyService _policyService ;
37- private readonly ISetInitialMasterPasswordCommand _setInitialMasterPasswordCommand ;
37+ private readonly IFinalizeOrgUserOnboardingAsync _finalizeOrgUserOnboarding ;
3838 private readonly ISetInitialMasterPasswordCommandV1 _setInitialMasterPasswordCommandV1 ;
3939 private readonly ITwoFactorIsEnabledQuery _twoFactorIsEnabledQuery ;
4040 private readonly ITdeSetPasswordCommand _tdeSetPasswordCommand ;
@@ -52,7 +52,7 @@ public AccountsControllerTests()
5252 _organizationUserRepository = Substitute . For < IOrganizationUserRepository > ( ) ;
5353 _providerUserRepository = Substitute . For < IProviderUserRepository > ( ) ;
5454 _policyService = Substitute . For < IPolicyService > ( ) ;
55- _setInitialMasterPasswordCommand = Substitute . For < ISetInitialMasterPasswordCommand > ( ) ;
55+ _finalizeOrgUserOnboarding = Substitute . For < IFinalizeOrgUserOnboardingAsync > ( ) ;
5656 _setInitialMasterPasswordCommandV1 = Substitute . For < ISetInitialMasterPasswordCommandV1 > ( ) ;
5757 _twoFactorIsEnabledQuery = Substitute . For < ITwoFactorIsEnabledQuery > ( ) ;
5858 _tdeSetPasswordCommand = Substitute . For < ITdeSetPasswordCommand > ( ) ;
@@ -69,7 +69,7 @@ public AccountsControllerTests()
6969 _providerUserRepository ,
7070 _userService ,
7171 _policyService ,
72- _setInitialMasterPasswordCommand ,
72+ _finalizeOrgUserOnboarding ,
7373 _setInitialMasterPasswordCommandV1 ,
7474 _tdeSetPasswordCommand ,
7575 _tdeOffboardingPasswordCommand ,
@@ -426,7 +426,7 @@ public async Task PostSetPasswordAsync_V1_WhenUserExistsAndSettingPasswordSuccee
426426 }
427427
428428 _userService . GetUserByPrincipalAsync ( Arg . Any < ClaimsPrincipal > ( ) ) . Returns ( Task . FromResult ( user ) ) ;
429- _setInitialMasterPasswordCommandV1 . SetInitialMasterPasswordAsync (
429+ _setInitialMasterPasswordCommandV1 . FinalizeOrgUserOnboardingAsync (
430430 user ,
431431 setInitialPasswordRequestModel . MasterPasswordHash ,
432432 setInitialPasswordRequestModel . Key ,
@@ -439,7 +439,7 @@ public async Task PostSetPasswordAsync_V1_WhenUserExistsAndSettingPasswordSuccee
439439 await _sut . PostSetPasswordAsync ( setInitialPasswordRequestModel ) ;
440440 // Assert
441441 await _setInitialMasterPasswordCommandV1 . Received ( 1 )
442- . SetInitialMasterPasswordAsync (
442+ . FinalizeOrgUserOnboardingAsync (
443443 Arg . Is < User > ( u => u == user ) ,
444444 Arg . Is < string > ( s => s == setInitialPasswordRequestModel . MasterPasswordHash ) ,
445445 Arg . Is < string > ( s => s == setInitialPasswordRequestModel . Key ) ,
@@ -484,7 +484,7 @@ public async Task PostSetPasswordAsync_V1_WhenUserExistsAndHasKeysAndKeysAreUpda
484484 } ;
485485
486486 _userService . GetUserByPrincipalAsync ( Arg . Any < ClaimsPrincipal > ( ) ) . Returns ( Task . FromResult ( user ) ) ;
487- _setInitialMasterPasswordCommandV1 . SetInitialMasterPasswordAsync (
487+ _setInitialMasterPasswordCommandV1 . FinalizeOrgUserOnboardingAsync (
488488 user ,
489489 setInitialPasswordRequestModel . MasterPasswordHash ,
490490 setInitialPasswordRequestModel . Key ,
@@ -520,7 +520,7 @@ public async Task PostSetPasswordAsync_V1_WhenSettingPasswordFails_ShouldThrowBa
520520 model . Keys = null ;
521521 // Arrange
522522 _userService . GetUserByPrincipalAsync ( Arg . Any < ClaimsPrincipal > ( ) ) . Returns ( Task . FromResult ( user ) ) ;
523- _setInitialMasterPasswordCommandV1 . SetInitialMasterPasswordAsync ( Arg . Any < User > ( ) , Arg . Any < string > ( ) , Arg . Any < string > ( ) , Arg . Any < string > ( ) )
523+ _setInitialMasterPasswordCommandV1 . FinalizeOrgUserOnboardingAsync ( Arg . Any < User > ( ) , Arg . Any < string > ( ) , Arg . Any < string > ( ) , Arg . Any < string > ( ) )
524524 . Returns ( Task . FromResult ( IdentityResult . Failed ( new IdentityError { Description = "Some Error" } ) ) ) ;
525525
526526 // Act & Assert
@@ -870,15 +870,15 @@ public async Task PostSetPasswordAsync_V2_WhenUserExistsAndSettingPasswordSuccee
870870 // Arrange
871871 UpdateSetInitialPasswordRequestModelToV2 ( setInitialPasswordRequestModel ) ;
872872 _userService . GetUserByPrincipalAsync ( Arg . Any < ClaimsPrincipal > ( ) ) . Returns ( Task . FromResult ( user ) ) ;
873- _setInitialMasterPasswordCommand . SetInitialMasterPasswordAsync ( user , Arg . Any < SetInitialMasterPasswordDataModel > ( ) )
873+ _finalizeOrgUserOnboarding . FinalizeOrgUserOnboardingAsync ( user , Arg . Any < SetInitialMasterPasswordDataModel > ( ) )
874874 . Returns ( Task . CompletedTask ) ;
875875
876876 // Act
877877 await _sut . PostSetPasswordAsync ( setInitialPasswordRequestModel ) ;
878878
879879 // Assert
880- await _setInitialMasterPasswordCommand . Received ( 1 )
881- . SetInitialMasterPasswordAsync (
880+ await _finalizeOrgUserOnboarding . Received ( 1 )
881+ . FinalizeOrgUserOnboardingAsync (
882882 Arg . Is < User > ( u => u == user ) ,
883883 Arg . Is < SetInitialMasterPasswordDataModel > ( d =>
884884 d . MasterPasswordAuthentication != null &&
@@ -935,7 +935,7 @@ public async Task PostSetPasswordAsync_V2_WhenSettingPasswordFails_ShouldThrowEx
935935 // Arrange
936936 UpdateSetInitialPasswordRequestModelToV2 ( setInitialPasswordRequestModel ) ;
937937 _userService . GetUserByPrincipalAsync ( Arg . Any < ClaimsPrincipal > ( ) ) . Returns ( Task . FromResult ( user ) ) ;
938- _setInitialMasterPasswordCommand . SetInitialMasterPasswordAsync ( user , Arg . Any < SetInitialMasterPasswordDataModel > ( ) )
938+ _finalizeOrgUserOnboarding . FinalizeOrgUserOnboardingAsync ( user , Arg . Any < SetInitialMasterPasswordDataModel > ( ) )
939939 . Returns ( Task . FromException ( new Exception ( "Setting password failed" ) ) ) ;
940940
941941 // Act & Assert
0 commit comments