@@ -327,80 +327,5 @@ public void ExplicitMockDistributedCacheShouldOverrideIt()
327
327
328
328
MyApplication . StartsFrom < DefaultStartup > ( ) ;
329
329
}
330
-
331
- [ Fact ]
332
- public void MockDistributedCacheShouldBeSameForAsyncronousCallToTestProvider ( )
333
- {
334
- Task
335
- . Run ( async ( ) =>
336
- {
337
- MyApplication
338
- . StartsFrom < DefaultStartup > ( )
339
- . WithServices ( services => services . AddDistributedMemoryCache ( ) ) ;
340
-
341
- var mockCache = TestServiceProvider . GetService < IDistributedCache > ( ) as IDistributedCacheMock ;
342
-
343
- TestHelper . GlobalTestCleanup += ( ) => mockCache ? . Dispose ( ) ;
344
- TestHelper . ExecuteTestCleanup ( ) ;
345
-
346
- byte [ ] firstValue = null ;
347
- byte [ ] secondValue = null ;
348
- byte [ ] thirdValue = null ;
349
- byte [ ] fourthValue = null ;
350
- byte [ ] fifthValue = null ;
351
-
352
- var tasks = new List < Task >
353
- {
354
- Task . Run ( ( ) =>
355
- {
356
- var distributedCache = TestServiceProvider . GetService < IDistributedCache > ( ) ;
357
- distributedCache . Set ( "test1" , new byte [ ] { 1 } ) ;
358
- firstValue = TestServiceProvider . GetService < IDistributedCache > ( ) . Get ( "test1" ) ;
359
- TestHelper . ExecuteTestCleanup ( ) ;
360
- } ) ,
361
- Task . Run ( ( ) =>
362
- {
363
- var distributedCache = TestServiceProvider . GetService < IDistributedCache > ( ) ;
364
- distributedCache . Set ( "test2" , new byte [ ] { 2 } ) ;
365
- secondValue = TestServiceProvider . GetService < IDistributedCache > ( ) . Get ( "test2" ) ;
366
- TestHelper . ExecuteTestCleanup ( ) ;
367
- } ) ,
368
- Task . Run ( ( ) =>
369
- {
370
- var distributedCache = TestServiceProvider . GetService < IDistributedCache > ( ) ;
371
- distributedCache . Set ( "test3" , new byte [ ] { 3 } ) ;
372
- thirdValue = TestServiceProvider . GetService < IDistributedCache > ( ) . Get ( "test3" ) ;
373
- TestHelper . ExecuteTestCleanup ( ) ;
374
- } ) ,
375
- Task . Run ( ( ) =>
376
- {
377
- var distributedCache = TestServiceProvider . GetService < IDistributedCache > ( ) ;
378
- distributedCache . Set ( "test4" , new byte [ ] { 4 } ) ;
379
- fourthValue = TestServiceProvider . GetService < IDistributedCache > ( ) . Get ( "test4" ) ;
380
- TestHelper . ExecuteTestCleanup ( ) ;
381
- } ) ,
382
- Task . Run ( ( ) =>
383
- {
384
- var distributedCache = TestServiceProvider . GetService < IDistributedCache > ( ) ;
385
- distributedCache . Set ( "test5" , new byte [ ] { 5 } ) ;
386
- fifthValue = TestServiceProvider . GetService < IDistributedCache > ( ) . Get ( "test5" ) ;
387
- TestHelper . ExecuteTestCleanup ( ) ;
388
- } )
389
- } ;
390
-
391
- await Task . WhenAll ( tasks ) ;
392
-
393
- Assert . Equal ( new byte [ ] { 1 } , firstValue ) ;
394
- Assert . Equal ( new byte [ ] { 2 } , secondValue ) ;
395
- Assert . Equal ( new byte [ ] { 3 } , thirdValue ) ;
396
- Assert . Equal ( new byte [ ] { 4 } , fourthValue ) ;
397
- Assert . Equal ( new byte [ ] { 5 } , fifthValue ) ;
398
-
399
- MyApplication . StartsFrom < DefaultStartup > ( ) ;
400
- } )
401
- . ConfigureAwait ( false )
402
- . GetAwaiter ( )
403
- . GetResult ( ) ;
404
- }
405
330
}
406
331
}
0 commit comments