@@ -834,9 +834,12 @@ public async Task WillNotSendConfirmationEmailWhenConfirmEmailAddressesIsOff()
834834 . Verify ( x
=> x . Register ( "theUsername" , "[email protected] " , It . IsAny < Credential > ( ) , false ) ) ; 835835
836836 GetMock < IMessageService > ( )
837- . Verify ( x => x . SendNewAccountEmailAsync (
838- It . IsAny < User > ( ) ,
839- It . IsAny < string > ( ) ) , Times . Never ( ) ) ;
837+ . Verify (
838+ x => x . SendMessageAsync (
839+ It . IsAny < NewAccountMessage > ( ) ,
840+ It . IsAny < bool > ( ) ,
841+ It . IsAny < bool > ( ) ) ,
842+ Times . Never ( ) ) ;
840843 }
841844
842845 [ Fact ]
@@ -869,6 +872,20 @@ public async Task WillNotAutoConfirmAndWillSendConfirmationEmailWhenNotExternalC
869872 UserInfo = new IdentityInformation ( "" , "" , authUser . User . UnconfirmedEmailAddress , "" )
870873 } ) ;
871874
875+ var confirmationUrl = TestUtility . GallerySiteRootHttps + "account/confirm/" + authUser . User . Username + "/" + authUser . User . EmailConfirmationToken ;
876+ var configurationService = GetConfigurationService ( ) ;
877+ var messageService = GetMock < IMessageService > ( ) ;
878+ messageService
879+ . Setup ( svc => svc . SendMessageAsync (
880+ It . Is < NewAccountMessage > (
881+ msg =>
882+ msg . User == authUser . User
883+ && msg . ConfirmationUrl == confirmationUrl ) ,
884+ false ,
885+ false ) )
886+ . Returns ( Task . CompletedTask )
887+ . Verifiable ( ) ;
888+
872889 // Act
873890 var result = await controller . Register (
874891 new LogOnViewModel ( )
@@ -886,10 +903,7 @@ public async Task WillNotAutoConfirmAndWillSendConfirmationEmailWhenNotExternalC
886903 GetMock < AuthenticationService > ( )
887904 . Verify ( x => x . Register ( authUser . User . Username , authUser . User . UnconfirmedEmailAddress , It . IsAny < Credential > ( ) , false ) ) ;
888905
889- GetMock < IMessageService > ( )
890- . Verify ( x => x . SendNewAccountEmailAsync (
891- authUser . User ,
892- TestUtility . GallerySiteRootHttps + "account/confirm/" + authUser . User . Username + "/" + authUser . User . EmailConfirmationToken ) ) ;
906+ messageService . Verify ( ) ;
893907
894908 ResultAssert . IsSafeRedirectTo ( result , "/theReturnUrl" ) ;
895909 }
@@ -926,6 +940,20 @@ public async Task WillNotAutoConfirmAndWillSendConfirmationEmailWhenModelRegiste
926940 UserInfo = new IdentityInformation ( "" , "" , "[email protected] " , "" ) 927941 } ) ;
928942
943+ var confirmationUrl = TestUtility . GallerySiteRootHttps + "account/confirm/" + authUser . User . Username + "/" + authUser . User . EmailConfirmationToken ;
944+ var configurationService = GetConfigurationService ( ) ;
945+ var messageService = GetMock < IMessageService > ( ) ;
946+ messageService
947+ . Setup ( svc => svc . SendMessageAsync (
948+ It . Is < NewAccountMessage > (
949+ msg =>
950+ msg . User == authUser . User
951+ && msg . ConfirmationUrl == confirmationUrl ) ,
952+ false ,
953+ false ) )
954+ . Returns ( Task . CompletedTask )
955+ . Verifiable ( ) ;
956+
929957 // Act
930958 var result = await controller . Register (
931959 new LogOnViewModel ( )
@@ -943,10 +971,7 @@ public async Task WillNotAutoConfirmAndWillSendConfirmationEmailWhenModelRegiste
943971 GetMock < AuthenticationService > ( )
944972 . Verify ( x
=> x . Register ( authUser . User . Username , "[email protected] " , externalCred , false ) ) ; 945973
946- GetMock < IMessageService > ( )
947- . Verify ( x => x . SendNewAccountEmailAsync (
948- authUser . User ,
949- TestUtility . GallerySiteRootHttps + "account/confirm/" + authUser . User . Username + "/" + authUser . User . EmailConfirmationToken ) ) ;
974+ messageService . Verify ( ) ;
950975
951976 ResultAssert . IsSafeRedirectTo ( result , "/theReturnUrl" ) ;
952977 }
0 commit comments