@@ -105,8 +105,23 @@ public async Task DoesNotFallBackToOldScopesWhenGitHubAndTwoFactorAuthFailsAndEr
105105 {
106106 var apiClient = Substitute . For < IApiClient > ( ) ;
107107 apiClient . HostAddress . Returns ( HostAddress . GitHubDotComHostAddress ) ;
108+ bool received1 = false , received2 = false ;
108109 apiClient . GetOrCreateApplicationAuthenticationCode ( Args . TwoFactorChallengCallback , null , false , true )
109- . Returns ( Observable . Throw < ApplicationAuthorization > ( new TwoFactorChallengeFailedException ( ) ) ) ;
110+ . Returns ( _ =>
111+ {
112+ received1 = true ;
113+ return Observable . Throw < ApplicationAuthorization > ( new TwoFactorChallengeFailedException ( ) ) ;
114+ } ) ;
115+
116+ apiClient . GetOrCreateApplicationAuthenticationCode ( Args . TwoFactorChallengCallback ,
117+ Args . String ,
118+ true ,
119+ Args . Boolean )
120+ . Returns ( _ =>
121+ {
122+ received2 = true ;
123+ return Observable . Throw < ApplicationAuthorization > ( new TwoFactorChallengeFailedException ( ) ) ;
124+ } ) ;
110125 apiClient . GetUser ( ) . Returns ( Observable . Return ( CreateOctokitUser ( "jiminy" ) ) ) ;
111126 var hostCache = new InMemoryBlobCache ( ) ;
112127 var modelService = new ModelService ( apiClient , hostCache , Substitute . For < IAvatarProvider > ( ) ) ;
@@ -115,13 +130,8 @@ public async Task DoesNotFallBackToOldScopesWhenGitHubAndTwoFactorAuthFailsAndEr
115130
116131 await host . LogIn ( "aUsername" , "aPassowrd" ) ;
117132
118- apiClient . Received ( )
119- . GetOrCreateApplicationAuthenticationCode ( Args . TwoFactorChallengCallback , null , false , true ) ;
120- apiClient . DidNotReceive ( ) . GetOrCreateApplicationAuthenticationCode (
121- Args . TwoFactorChallengCallback ,
122- Args . String ,
123- true ,
124- Args . Boolean ) ;
133+ Assert . True ( received1 ) ;
134+ Assert . False ( received2 ) ;
125135 Assert . False ( host . IsLoggedIn ) ;
126136 var loginInfo = await loginCache . GetLoginAsync ( HostAddress . GitHubDotComHostAddress ) ;
127137 Assert . Equal ( "" , loginInfo . UserName ) ;
0 commit comments