File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
BitFaster.Caching.UnitTests Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -590,6 +590,15 @@ public void WhenKeyIsRemovedItIsRemoved()
590590 cache . TryGet ( 1 , out var value ) . Should ( ) . BeFalse ( ) ;
591591 }
592592
593+ [ Fact ]
594+ public void WhenKeyExistsTryRemoveReturnsValue ( )
595+ {
596+ cache . GetOrAdd ( 1 , valueFactory . Create ) ;
597+
598+ cache . TryRemove ( 1 , out var value ) . Should ( ) . BeTrue ( ) ;
599+ value . Should ( ) . Be ( 1 ) ;
600+ }
601+
593602 [ Fact ]
594603 public void WhenItemIsRemovedItIsRemoved ( )
595604 {
Original file line number Diff line number Diff line change @@ -362,6 +362,15 @@ public void WhenKeyExistsTryRemoveRemovesItemAndReturnsTrue()
362362 lru . TryGet ( 1 , out var value ) . Should ( ) . BeFalse ( ) ;
363363 }
364364
365+ [ Fact ]
366+ public void WhenKeyExistsTryRemoveReturnsValue ( )
367+ {
368+ lru . GetOrAdd ( 1 , valueFactory . Create ) ;
369+
370+ lru . TryRemove ( 1 , out var value ) . Should ( ) . BeTrue ( ) ;
371+ value . Should ( ) . Be ( "1" ) ;
372+ }
373+
365374 [ Fact ]
366375 public void WhenItemExistsTryRemovesItemAndReturnsTrue ( )
367376 {
Original file line number Diff line number Diff line change @@ -634,6 +634,15 @@ public void WhenKeyExistsTryRemoveRemovesItemAndReturnsTrue()
634634
635635 lru . TryRemove ( 1 ) . Should ( ) . BeTrue ( ) ;
636636 lru . TryGet ( 1 , out var value ) . Should ( ) . BeFalse ( ) ;
637+ }
638+
639+ [ Fact ]
640+ public void WhenKeyExistsTryRemoveReturnsValue ( )
641+ {
642+ lru . GetOrAdd ( 1 , valueFactory . Create ) ;
643+
644+ lru . TryRemove ( 1 , out var value ) . Should ( ) . BeTrue ( ) ;
645+ value . Should ( ) . Be ( "1" ) ;
637646 }
638647
639648 [ Fact ]
You can’t perform that action at this time.
0 commit comments