@@ -553,7 +553,7 @@ public async Task ExpiredIndexClearsItems()
553553 indexobj . UpdatedAt = DateTimeOffset . UtcNow - TimeSpan . FromMinutes ( 6 ) ;
554554 await cache . InsertObject ( indexKey , indexobj ) ;
555555
556- var prlive = Observable . Range ( 6 , expected )
556+ var prlive = Observable . Range ( 5 , expected )
557557 . Select ( id => CreatePullRequest ( user , id , ItemState . Open , "Live " + id , DateTimeOffset . UtcNow , DateTimeOffset . UtcNow , 0 ) )
558558 . DelaySubscription ( TimeSpan . FromMilliseconds ( 10 ) ) ;
559559
@@ -567,9 +567,10 @@ public async Task ExpiredIndexClearsItems()
567567 var evt = new ManualResetEvent ( false ) ;
568568 col . Subscribe ( t =>
569569 {
570- // we get all the items from the cache, all the items from the live,
571- // and all the deletions because the cache expires old items when it's refreshed
572- if ( ++ count == expected * 3 )
570+ // we get all the items from the cache (items 1-5), all the items from the live (items 5-9),
571+ // and 4 deletions (items 1-4) because the cache expired the items that were not
572+ // a part of the live data
573+ if ( ++ count == 14 )
573574 evt . Set ( ) ;
574575 } , ( ) => { } ) ;
575576
@@ -578,7 +579,13 @@ public async Task ExpiredIndexClearsItems()
578579 evt . Reset ( ) ;
579580
580581 Assert . Equal ( 5 , col . Count ) ;
581- Assert . Collection ( col , col . Select ( x => new Action < IPullRequestModel > ( t => Assert . True ( x . Title . StartsWith ( "Live" ) ) ) ) . ToArray ( ) ) ;
582+ Assert . Collection ( col ,
583+ t => { Assert . True ( t . Title . StartsWith ( "Live" ) ) ; Assert . Equal ( 5 , t . Number ) ; } ,
584+ t => { Assert . True ( t . Title . StartsWith ( "Live" ) ) ; Assert . Equal ( 6 , t . Number ) ; } ,
585+ t => { Assert . True ( t . Title . StartsWith ( "Live" ) ) ; Assert . Equal ( 7 , t . Number ) ; } ,
586+ t => { Assert . True ( t . Title . StartsWith ( "Live" ) ) ; Assert . Equal ( 8 , t . Number ) ; } ,
587+ t => { Assert . True ( t . Title . StartsWith ( "Live" ) ) ; Assert . Equal ( 9 , t . Number ) ; }
588+ ) ;
582589 }
583590 }
584591
0 commit comments