@@ -34,9 +34,9 @@ public void SlidingCache_CacheOperations()
34
34
cache . Count . Should ( ) . Be ( 3 , $ "Expected 3 items in the cache, only had { cache . Count } ") ;
35
35
36
36
// Test retrieval
37
- Assert . True ( cache . TryGetValue ( 1 , out var value1 ) , "Expected to find the value, but did not" ) ;
38
- Assert . True ( cache . TryGetValue ( 2 , out var value2 ) , "Expected to find the value, but did not" ) ;
39
- Assert . True ( cache . TryGetValue ( 3 , out var value3 ) , "Expected to find the value, but did not" ) ;
37
+ Assert . True ( cache . TryGetValue ( 1 , out _ ) , "Expected to find the value, but did not" ) ;
38
+ Assert . True ( cache . TryGetValue ( 2 , out _ ) , "Expected to find the value, but did not" ) ;
39
+ Assert . True ( cache . TryGetValue ( 3 , out _ ) , "Expected to find the value, but did not" ) ;
40
40
41
41
// Test Removal
42
42
cache . Remove ( 1 ) ;
@@ -58,7 +58,7 @@ public void SlidingCache_TestExpire()
58
58
cache . AddOrUpdate ( 1 , "one" ) ;
59
59
60
60
// move the time forward
61
- var newDateTime = dateTimeUtilsMock . Object . UtcNow . AddMinutes ( 11 ) ;
61
+ var newDateTime = UtcNow . AddMinutes ( 11 ) ;
62
62
dateTimeUtilsMock . SetupGet ( d => d . UtcNow ) . Returns ( newDateTime ) ;
63
63
64
64
// Ensure that the element has expired
@@ -79,12 +79,12 @@ public void SlidingCache_TestReturnExpiredItems()
79
79
// Act
80
80
cache . AddOrUpdate ( 1 , "one" ) ;
81
81
82
- // move the time forward
83
- var newDateTime = dateTimeUtilsMock . Object . UtcNow . AddMinutes ( 11 ) ;
82
+ // move the time forward
83
+ var newDateTime = UtcNow . AddMinutes ( 11 ) ;
84
84
dateTimeUtilsMock . SetupGet ( d => d . UtcNow ) . Returns ( newDateTime ) ;
85
85
86
86
// Ensure the expired item is returned from the cache
87
- cache . TryGetValue ( 1 , out _ ) . Should ( ) . BeTrue ( $ "Expected to return expired item") ;
87
+ cache . TryGetValue ( 1 , out _ ) . Should ( ) . BeTrue ( "Expected to return expired item" ) ;
88
88
}
89
89
90
90
[ Fact ]
@@ -103,10 +103,10 @@ public void SlidingCache_TestAutoExpire()
103
103
cache . AddOrUpdate ( 1 , "one" ) ;
104
104
105
105
// Ensure one item is in the cache
106
- cache . Count . Should ( ) . Be ( 1 , $ "Expected 1 items in the cache, only had { cache . Count } ") ;
106
+ cache . Count . Should ( ) . Be ( 1 , $ "Expected 1 items in the cache, had { cache . Count } ") ;
107
107
108
108
// move the time forward
109
- var newDateTime = dateTimeUtilsMock . Object . UtcNow . AddMinutes ( 11 ) ;
109
+ var newDateTime = UtcNow . AddMinutes ( 11 ) ;
110
110
dateTimeUtilsMock . SetupGet ( d => d . UtcNow ) . Returns ( newDateTime ) ;
111
111
112
112
// Trigger the cleanup, asking for non-existing key
@@ -117,7 +117,7 @@ public void SlidingCache_TestAutoExpire()
117
117
Threading . Thread . Sleep ( 10 ) ;
118
118
119
119
// Ensure one item is in the cache
120
- cache . Count . Should ( ) . Be ( 0 , $ "Expected 0 items in the cache, only had { cache . Count } ") ;
120
+ cache . Count . Should ( ) . Be ( 0 , $ "Expected 0 items in the cache, had { cache . Count } ") ;
121
121
}
122
122
123
123
[ Fact ]
@@ -150,7 +150,7 @@ public void SlidingCache_TestMinNumberBeforeTests()
150
150
cache . Count . Should ( ) . Be ( 1 , $ "Expected 1 items in the cache, only had { cache . Count } ") ;
151
151
152
152
// move the time forward
153
- var newDateTime = dateTimeUtilsMock . Object . UtcNow . AddMinutes ( 11 ) ;
153
+ var newDateTime = UtcNow . AddMinutes ( 11 ) ;
154
154
dateTimeUtilsMock . SetupGet ( d => d . UtcNow ) . Returns ( newDateTime ) ;
155
155
156
156
// Trigger the cleanup, asking for non-existing key
0 commit comments