@@ -21,13 +21,13 @@ public async Task LoginTokenIsSavedToCache()
2121 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) )
2222 . Returns ( new ApplicationAuthorization ( "123abc" ) ) ;
2323
24- var loginCache = Substitute . For < ILoginCache > ( ) ;
24+ var loginCache = Substitute . For < IKeychain > ( ) ;
2525 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
2626
2727 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
2828 await target . Login ( host , client , "foo" , "bar" ) ;
2929
30- await loginCache . Received ( ) . SaveLogin ( "foo" , "123abc" , host ) ;
30+ await loginCache . Received ( ) . Save ( "foo" , "123abc" , host ) ;
3131 }
3232
3333 [ Fact ]
@@ -39,7 +39,7 @@ public async Task LoggedInUserIsReturned()
3939 . Returns ( new ApplicationAuthorization ( "123abc" ) ) ;
4040 client . User . Current ( ) . Returns ( user ) ;
4141
42- var loginCache = Substitute . For < ILoginCache > ( ) ;
42+ var loginCache = Substitute . For < IKeychain > ( ) ;
4343 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
4444
4545 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
@@ -62,15 +62,15 @@ public async Task DeletesExistingAuthenticationIfNullTokenReturned()
6262 new ApplicationAuthorization ( "123abc" ) ) ;
6363 client . User . Current ( ) . Returns ( user ) ;
6464
65- var loginCache = Substitute . For < ILoginCache > ( ) ;
65+ var loginCache = Substitute . For < IKeychain > ( ) ;
6666 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
6767
6868 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
6969 var result = await target . Login ( host , client , "foo" , "bar" ) ;
7070
7171 await client . Authorization . Received ( 2 ) . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) ) ;
7272 await client . Authorization . Received ( 1 ) . Delete ( 0 ) ;
73- await loginCache . Received ( ) . SaveLogin ( "foo" , "123abc" , host ) ;
73+ await loginCache . Received ( ) . Save ( "foo" , "123abc" , host ) ;
7474 }
7575
7676 [ Fact ]
@@ -84,7 +84,7 @@ public async Task TwoFactorExceptionIsPassedToHandler()
8484 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) , "123456" )
8585 . Returns ( new ApplicationAuthorization ( "123abc" ) ) ;
8686
87- var loginCache = Substitute . For < ILoginCache > ( ) ;
87+ var loginCache = Substitute . For < IKeychain > ( ) ;
8888 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
8989 tfa . HandleTwoFactorException ( exception ) . Returns ( new TwoFactorChallengeResult ( "123456" ) ) ;
9090
@@ -111,7 +111,7 @@ public async Task Failed2FACodeResultsInRetry()
111111 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) , "123456" )
112112 . Returns ( new ApplicationAuthorization ( "123abc" ) ) ;
113113
114- var loginCache = Substitute . For < ILoginCache > ( ) ;
114+ var loginCache = Substitute . For < IKeychain > ( ) ;
115115 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
116116 tfa . HandleTwoFactorException ( exception ) . Returns (
117117 new TwoFactorChallengeResult ( "111111" ) ,
@@ -146,7 +146,7 @@ public async Task HandlerNotifiedOfExceptionIn2FAChallengeResponse()
146146 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) , "111111" )
147147 . Returns < ApplicationAuthorization > ( _ => { throw loginAttemptsException ; } ) ;
148148
149- var loginCache = Substitute . For < ILoginCache > ( ) ;
149+ var loginCache = Substitute . For < IKeychain > ( ) ;
150150 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
151151 tfa . HandleTwoFactorException ( twoFaException ) . Returns (
152152 new TwoFactorChallengeResult ( "111111" ) ,
@@ -176,7 +176,7 @@ public async Task RequestResendCodeResultsInRetryingLogin()
176176 . Returns ( new ApplicationAuthorization ( "456def" ) ) ;
177177 client . User . Current ( ) . Returns ( user ) ;
178178
179- var loginCache = Substitute . For < ILoginCache > ( ) ;
179+ var loginCache = Substitute . For < IKeychain > ( ) ;
180180 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
181181 tfa . HandleTwoFactorException ( exception ) . Returns (
182182 TwoFactorChallengeResult . RequestResendCode ,
@@ -201,13 +201,13 @@ public async Task UsesUsernameAndPasswordInsteadOfAuthorizationTokenWhenEnterpri
201201 } ) ;
202202 client . User . Current ( ) . Returns ( user ) ;
203203
204- var loginCache = Substitute . For < ILoginCache > ( ) ;
204+ var loginCache = Substitute . For < IKeychain > ( ) ;
205205 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
206206
207207 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
208208 await target . Login ( enterprise , client , "foo" , "bar" ) ;
209209
210- await loginCache . Received ( ) . SaveLogin ( "foo" , "bar" , enterprise ) ;
210+ await loginCache . Received ( ) . Save ( "foo" , "bar" , enterprise ) ;
211211 }
212212
213213 [ Fact ]
@@ -219,13 +219,13 @@ public async Task ErasesLoginWhenUnauthorized()
219219 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) )
220220 . Returns < ApplicationAuthorization > ( _ => { throw new AuthorizationException ( ) ; } ) ;
221221
222- var loginCache = Substitute . For < ILoginCache > ( ) ;
222+ var loginCache = Substitute . For < IKeychain > ( ) ;
223223 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
224224
225225 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
226226 await Assert . ThrowsAsync < AuthorizationException > ( async ( ) => await target . Login ( enterprise , client , "foo" , "bar" ) ) ;
227227
228- await loginCache . Received ( ) . EraseLogin ( enterprise ) ;
228+ await loginCache . Received ( ) . Delete ( enterprise ) ;
229229 }
230230
231231 [ Fact ]
@@ -237,13 +237,13 @@ public async Task ErasesLoginWhenNonOctokitExceptionThrown()
237237 client . Authorization . GetOrCreateApplicationAuthentication ( "id" , "secret" , Arg . Any < NewAuthorization > ( ) )
238238 . Returns < ApplicationAuthorization > ( _ => { throw new InvalidOperationException ( ) ; } ) ;
239239
240- var loginCache = Substitute . For < ILoginCache > ( ) ;
240+ var loginCache = Substitute . For < IKeychain > ( ) ;
241241 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
242242
243243 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
244244 await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) => await target . Login ( host , client , "foo" , "bar" ) ) ;
245245
246- await loginCache . Received ( ) . EraseLogin ( host ) ;
246+ await loginCache . Received ( ) . Delete ( host ) ;
247247 }
248248
249249 [ Fact ]
@@ -259,14 +259,14 @@ public async Task ErasesLoginWhenNonOctokitExceptionThrownIn2FA()
259259 . Returns < ApplicationAuthorization > ( _ => { throw new InvalidOperationException ( ) ; } ) ;
260260 client . User . Current ( ) . Returns ( user ) ;
261261
262- var loginCache = Substitute . For < ILoginCache > ( ) ;
262+ var loginCache = Substitute . For < IKeychain > ( ) ;
263263 var tfa = Substitute . For < ITwoFactorChallengeHandler > ( ) ;
264264 tfa . HandleTwoFactorException ( exception ) . Returns ( new TwoFactorChallengeResult ( "123456" ) ) ;
265265
266266 var target = new LoginManager ( loginCache , tfa , "id" , "secret" ) ;
267267 await Assert . ThrowsAsync < InvalidOperationException > ( async ( ) => await target . Login ( host , client , "foo" , "bar" ) ) ;
268268
269- await loginCache . Received ( ) . EraseLogin ( host ) ;
269+ await loginCache . Received ( ) . Delete ( host ) ;
270270 }
271271 }
272272}
0 commit comments