@@ -50,7 +50,7 @@ public class PassportImplTests
50
50
internal static string CODE = "IMX" ;
51
51
internal static string URL = "https://auth.immutable.com/device" ;
52
52
internal static string LOGOUT_URL = "https://auth.immutable.com/logout" ;
53
- internal static int INTERVAL = 5000 ;
53
+ internal static int INTERVAL = 5 ;
54
54
private const string REQUEST_ID = "50" ;
55
55
56
56
#pragma warning disable CS8618
@@ -92,7 +92,8 @@ public async Task Login_Logout_Success()
92
92
success = true ,
93
93
code = CODE ,
94
94
deviceCode = DEVICE_CODE ,
95
- url = URL
95
+ url = URL ,
96
+ interval = INTERVAL
96
97
} ;
97
98
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
98
99
var confirmCodeResponse = new BrowserResponse
@@ -137,7 +138,8 @@ public async Task Login_Soft_Logout_Success()
137
138
success = true ,
138
139
code = CODE ,
139
140
deviceCode = DEVICE_CODE ,
140
- url = URL
141
+ url = URL ,
142
+ interval = INTERVAL
141
143
} ;
142
144
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
143
145
var confirmCodeResponse = new BrowserResponse
@@ -304,6 +306,66 @@ public async Task Login_ConfirmCode_NullResponse_Failed()
304
306
Assert . AreEqual ( expectedEvents , authEvents ) ;
305
307
}
306
308
309
+ [ Test ]
310
+ public async Task Login_ValidTimeout ( )
311
+ {
312
+ var deviceConnectResponse = new DeviceConnectResponse
313
+ {
314
+ success = true ,
315
+ code = CODE ,
316
+ deviceCode = DEVICE_CODE ,
317
+ url = URL ,
318
+ interval = INTERVAL
319
+ } ;
320
+ communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
321
+ var confirmCodeResponse = new BrowserResponse
322
+ {
323
+ success = true
324
+ } ;
325
+ communicationsManager . AddMockResponse ( confirmCodeResponse ) ;
326
+
327
+ // Login
328
+ bool success = false ;
329
+ ArgumentException e = null ;
330
+ try
331
+ {
332
+ success = await passport . Login ( timeoutMs : 6000 ) ;
333
+ }
334
+ catch ( ArgumentException exception )
335
+ {
336
+ e = exception ;
337
+ }
338
+
339
+ Assert . Null ( e ) ;
340
+ Assert . True ( success ) ;
341
+ }
342
+
343
+ [ Test ]
344
+ public async Task Login_InvalidTimeout ( )
345
+ {
346
+ var deviceConnectResponse = new DeviceConnectResponse
347
+ {
348
+ success = true ,
349
+ code = CODE ,
350
+ deviceCode = DEVICE_CODE ,
351
+ url = URL ,
352
+ interval = INTERVAL
353
+ } ;
354
+ communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
355
+
356
+ ArgumentException e = null ;
357
+ try
358
+ {
359
+ await passport . Login ( timeoutMs : 1 ) ;
360
+ }
361
+ catch ( ArgumentException exception )
362
+ {
363
+ e = exception ;
364
+ }
365
+
366
+ Assert . NotNull ( e ) ;
367
+ }
368
+
307
369
[ Test ]
308
370
public async Task Relogin_Success ( )
309
371
{
@@ -413,7 +475,8 @@ public async Task ConnectImx_Logout_Success()
413
475
success = true ,
414
476
code = CODE ,
415
477
deviceCode = DEVICE_CODE ,
416
- url = URL
478
+ url = URL ,
479
+ interval = INTERVAL
417
480
} ;
418
481
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
419
482
var confirmCodeResponse = new BrowserResponse
@@ -564,7 +627,8 @@ public async Task ConnectImx_ConfirmCode_Failed()
564
627
success = true ,
565
628
code = CODE ,
566
629
deviceCode = DEVICE_CODE ,
567
- url = URL
630
+ url = URL ,
631
+ interval = INTERVAL
568
632
} ;
569
633
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
570
634
var confirmCodeResponse = new BrowserResponse
@@ -622,7 +686,8 @@ public async Task ConnectImx_ConfirmCode_NullResponse_Failed()
622
686
success = true ,
623
687
code = CODE ,
624
688
deviceCode = DEVICE_CODE ,
625
- url = URL
689
+ url = URL ,
690
+ interval = INTERVAL
626
691
} ;
627
692
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
628
693
@@ -677,7 +742,8 @@ public async Task ConnectImx_HasCredentialsSaved_CannotReconnect_Logout_Success(
677
742
success = true ,
678
743
code = CODE ,
679
744
deviceCode = DEVICE_CODE ,
680
- url = URL
745
+ url = URL ,
746
+ interval = INTERVAL
681
747
} ;
682
748
communicationsManager . AddMockResponse ( deviceConnectResponse ) ;
683
749
var confirmCodeResponse = new BrowserResponse
0 commit comments