@@ -24,7 +24,7 @@ public async Task CacheBehavior_DisableCache_NotCacheAsync()
24
24
local . AddCacheValue ( "cacheKey" , "cacheValue" ) ;
25
25
var remote = Substitute . For < IRemoteCacheProvider > ( ) ;
26
26
remote . AddCacheValue ( "cacheKey" , "cacheValue" ) ;
27
- var behavior = GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > { local , remote } ) ;
27
+ var behavior = GetBehavior < FakeQuery < string > , string > ( [ local , remote ] ) ;
28
28
29
29
// Act
30
30
var result = await behavior . Handle (
@@ -33,7 +33,7 @@ public async Task CacheBehavior_DisableCache_NotCacheAsync()
33
33
LocalCacheBehavior = CacheBehavior . DisabledCache ,
34
34
RemoteCacheBehavior = CacheBehavior . DisabledCache
35
35
} ,
36
- ( ) => Task . FromResult ( "noCache" ) ,
36
+ _ => Task . FromResult ( "noCache" ) ,
37
37
CancellationToken . None ) ;
38
38
39
39
// Assert
@@ -45,7 +45,7 @@ public async Task CacheBehavior_EnableLocal_NoCache_UpdateAsync()
45
45
{
46
46
// Arrange
47
47
var local = Substitute . For < ILocalCacheProvider > ( ) ;
48
- var behavior = GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > { local } ) ;
48
+ var behavior = GetBehavior < FakeQuery < string > , string > ( [ local ] ) ;
49
49
50
50
// Act
51
51
var result = await behavior . Handle (
@@ -55,7 +55,7 @@ public async Task CacheBehavior_EnableLocal_NoCache_UpdateAsync()
55
55
LocalExpires = TimeSpan . FromSeconds ( 1 ) ,
56
56
RemoteCacheBehavior = CacheBehavior . DisabledCache
57
57
} ,
58
- ( ) => Task . FromResult ( "noCache" ) ,
58
+ _ => Task . FromResult ( "noCache" ) ,
59
59
CancellationToken . None ) ;
60
60
61
61
// Assert
@@ -70,7 +70,7 @@ public async Task CacheBehavior_EnableLocal_HasCache_UseCacheAsync()
70
70
var local = Substitute . For < ILocalCacheProvider > ( ) ;
71
71
local . AddCacheValue ( "cacheKey" , "cacheValue" ) ;
72
72
var remote = Substitute . For < IRemoteCacheProvider > ( ) ;
73
- var behavior = GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > { local , remote } ) ;
73
+ var behavior = GetBehavior < FakeQuery < string > , string > ( [ local , remote ] ) ;
74
74
75
75
// Act
76
76
var result = await behavior . Handle (
@@ -80,7 +80,7 @@ public async Task CacheBehavior_EnableLocal_HasCache_UseCacheAsync()
80
80
LocalExpires = TimeSpan . FromSeconds ( 1 ) ,
81
81
RemoteCacheBehavior = CacheBehavior . DisabledCache
82
82
} ,
83
- ( ) => Task . FromResult ( "noCache" ) ,
83
+ _ => Task . FromResult ( "noCache" ) ,
84
84
CancellationToken . None ) ;
85
85
86
86
// Assert
@@ -95,7 +95,7 @@ public async Task CacheBehavior_EnableRemote_NoCache_UpdateAsync()
95
95
// Arrange
96
96
var remote = Substitute . For < IRemoteCacheProvider > ( ) ;
97
97
var local = Substitute . For < ILocalCacheProvider > ( ) ;
98
- var behavior = GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > { local , remote } ) ;
98
+ var behavior = GetBehavior < FakeQuery < string > , string > ( [ local , remote ] ) ;
99
99
100
100
// Act
101
101
var result = await behavior . Handle (
@@ -105,7 +105,7 @@ public async Task CacheBehavior_EnableRemote_NoCache_UpdateAsync()
105
105
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
106
106
RemoteExpires = TimeSpan . FromSeconds ( 1 )
107
107
} ,
108
- ( ) => Task . FromResult ( "noCache" ) ,
108
+ _ => Task . FromResult ( "noCache" ) ,
109
109
CancellationToken . None ) ;
110
110
111
111
// Assert
@@ -120,7 +120,7 @@ public async Task CacheBehavior_EnableRemote_HasCache_UseCacheAsync()
120
120
// Arrange
121
121
var remote = Substitute . For < IRemoteCacheProvider > ( ) . AddCacheValue ( "cacheKey" , "cacheValue" ) ;
122
122
var local = Substitute . For < ILocalCacheProvider > ( ) ;
123
- var behavior = GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > { local , remote } ) ;
123
+ var behavior = GetBehavior < FakeQuery < string > , string > ( [ local , remote ] ) ;
124
124
125
125
// Act
126
126
var result = await behavior . Handle (
@@ -130,7 +130,7 @@ public async Task CacheBehavior_EnableRemote_HasCache_UseCacheAsync()
130
130
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
131
131
RemoteExpires = TimeSpan . FromSeconds ( 1 )
132
132
} ,
133
- ( ) => Task . FromResult ( "noCache" ) ,
133
+ _ => Task . FromResult ( "noCache" ) ,
134
134
CancellationToken . None ) ;
135
135
136
136
// Assert
@@ -145,7 +145,7 @@ public async Task CacheBehavior_ThrowOnGet_ThrowAsync()
145
145
var remote = Substitute . For < IRemoteCacheProvider > ( ) ;
146
146
remote . GetAsync < string > ( Arg . Any < string > ( ) ) . ThrowsAsync ( new Exception ( "test" ) ) ;
147
147
var behavior = GetBehavior < FakeQuery < string > , string > (
148
- new List < ICacheProvider > ( ) { remote } ,
148
+ [ remote ] ,
149
149
o => o . ThrowIfFailedOnGet = true ) ;
150
150
151
151
// Act
@@ -156,7 +156,7 @@ public async Task CacheBehavior_ThrowOnGet_ThrowAsync()
156
156
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
157
157
RemoteExpires = TimeSpan . FromSeconds ( 1 )
158
158
} ,
159
- ( ) => Task . FromResult ( "noCache" ) ,
159
+ _ => Task . FromResult ( "noCache" ) ,
160
160
CancellationToken . None ) ;
161
161
162
162
// Assert
@@ -170,7 +170,7 @@ public async Task CacheBehavior_ThrowOnGet_NoThrowAsync()
170
170
var remote = Substitute . For < IRemoteCacheProvider > ( ) ;
171
171
remote . GetAsync < string > ( Arg . Any < string > ( ) ) . ThrowsAsync ( new Exception ( "test" ) ) ;
172
172
var behavior = GetBehavior < FakeQuery < string > , string > (
173
- new List < ICacheProvider > ( ) { remote } ,
173
+ [ remote ] ,
174
174
o => o . ThrowIfFailedOnGet = false ) ;
175
175
176
176
// Act
@@ -181,7 +181,7 @@ public async Task CacheBehavior_ThrowOnGet_NoThrowAsync()
181
181
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
182
182
RemoteExpires = TimeSpan . FromSeconds ( 1 )
183
183
} ,
184
- ( ) => Task . FromResult ( "noCache" ) ,
184
+ _ => Task . FromResult ( "noCache" ) ,
185
185
CancellationToken . None ) ;
186
186
187
187
// Assert
@@ -196,7 +196,7 @@ public async Task CacheBehavior_ThrowOnUpdate_ThrowAsync()
196
196
remote . UpdateAsync ( Arg . Any < string > ( ) , Arg . Any < string > ( ) , Arg . Any < TimeSpan > ( ) )
197
197
. ThrowsAsync ( new Exception ( "test" ) ) ;
198
198
var behavior = GetBehavior < FakeQuery < string > , string > (
199
- new List < ICacheProvider > { remote } ,
199
+ [ remote ] ,
200
200
o => o . ThrowIfFailedOnUpdate = true ) ;
201
201
202
202
// Act
@@ -207,7 +207,7 @@ public async Task CacheBehavior_ThrowOnUpdate_ThrowAsync()
207
207
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
208
208
RemoteExpires = TimeSpan . FromSeconds ( 1 )
209
209
} ,
210
- ( ) => Task . FromResult ( "noCache" ) ,
210
+ _ => Task . FromResult ( "noCache" ) ,
211
211
CancellationToken . None ) ;
212
212
213
213
// Assert
@@ -222,7 +222,7 @@ public async Task CacheBehavior_NotThrowOnUpdate_NotThrowAsync()
222
222
remote . UpdateAsync ( Arg . Any < string > ( ) , Arg . Any < string > ( ) , Arg . Any < TimeSpan > ( ) )
223
223
. ThrowsAsync ( new Exception ( "test" ) ) ;
224
224
var behavior = GetBehavior < FakeQuery < string > , string > (
225
- new List < ICacheProvider > { remote } ,
225
+ [ remote ] ,
226
226
o => o . ThrowIfFailedOnUpdate = false ) ;
227
227
228
228
// Act
@@ -233,7 +233,7 @@ public async Task CacheBehavior_NotThrowOnUpdate_NotThrowAsync()
233
233
RemoteCacheBehavior = CacheBehavior . UpdateCacheIfMiss ,
234
234
RemoteExpires = TimeSpan . FromSeconds ( 1 )
235
235
} ,
236
- ( ) => Task . FromResult ( "noCache" ) ,
236
+ _ => Task . FromResult ( "noCache" ) ,
237
237
CancellationToken . None ) ;
238
238
239
239
// Assert
@@ -244,7 +244,7 @@ public async Task CacheBehavior_NotThrowOnUpdate_NotThrowAsync()
244
244
public void CacheBehavior_NoProvider_Throw ( )
245
245
{
246
246
// Act
247
- var act = ( ) => GetBehavior < FakeQuery < string > , string > ( new List < ICacheProvider > ( ) ) ;
247
+ var act = ( ) => GetBehavior < FakeQuery < string > , string > ( [ ] ) ;
248
248
249
249
// Assert
250
250
act . Should ( ) . Throw < InvalidOperationException > ( ) ;
0 commit comments