@@ -270,8 +270,12 @@ public void CanCreateRedisAndSqlServerBackedHybridCaches()
270
270
[ Fact ]
271
271
public void CanParseOptions_NoEntryOptions ( )
272
272
{
273
- var source = new JsonConfigurationSource { Path = "BasicConfig.json" } ;
274
- var configBuilder = new ConfigurationBuilder { Sources = { source } } ;
273
+ var configBuilder = new ConfigurationBuilder ( ) ;
274
+
275
+ configBuilder . AddInMemoryCollection ( [
276
+ new ( "no_entry_options:MaximumKeyLength" , "937" )
277
+ ] ) ;
278
+
275
279
var config = configBuilder . Build ( ) ;
276
280
var options = new HybridCacheOptions ( ) ;
277
281
ConfigurationBinder . Bind ( config , "no_entry_options" , options ) ;
@@ -283,8 +287,14 @@ public void CanParseOptions_NoEntryOptions()
283
287
[ Fact ]
284
288
public void CanParseOptions_WithEntryOptions ( ) // in particular, check we can parse the timespan and [Flags] enums
285
289
{
286
- var source = new JsonConfigurationSource { Path = "BasicConfig.json" } ;
287
- var configBuilder = new ConfigurationBuilder { Sources = { source } } ;
290
+ var configBuilder = new ConfigurationBuilder ( ) ;
291
+
292
+ configBuilder . AddInMemoryCollection ( [
293
+ new ( "with_entry_options:MaximumKeyLength" , "937" ) ,
294
+ new ( "with_entry_options:DefaultEntryOptions:Flags" , "DisableCompression, DisableLocalCacheRead" ) ,
295
+ new ( "with_entry_options:DefaultEntryOptions:LocalCacheExpiration" , "00:02:00" )
296
+ ] ) ;
297
+
288
298
var config = configBuilder . Build ( ) ;
289
299
var options = new HybridCacheOptions ( ) ;
290
300
ConfigurationBinder . Bind ( config , "with_entry_options" , options ) ;
@@ -300,8 +310,13 @@ public void CanParseOptions_WithEntryOptions() // in particular, check we can pa
300
310
[ Fact ]
301
311
public void CanCreateKeyedServicesWithKeyedDistributedCaches_UsingNamedOptions ( )
302
312
{
303
- var source = new JsonConfigurationSource { Path = "BasicConfig.json" } ;
304
- var configBuilder = new ConfigurationBuilder { Sources = { source } } ;
313
+ var configBuilder = new ConfigurationBuilder ( ) ;
314
+
315
+ configBuilder . AddInMemoryCollection ( [
316
+ new ( "HybridOne:DistributedCacheServiceKey" , "DistributedOne" ) ,
317
+ new ( "HybridTwo:DistributedCacheServiceKey" , "DistributedTwo" )
318
+ ] ) ;
319
+
305
320
var config = configBuilder . Build ( ) ;
306
321
307
322
var services = new ServiceCollection ( ) ;
@@ -335,8 +350,13 @@ public void CanCreateKeyedServicesWithKeyedDistributedCaches_UsingNamedOptions()
335
350
[ Fact ]
336
351
public void CanCreateKeyedServicesWithKeyedDistributedCaches_UsingSetupActions ( )
337
352
{
338
- var source = new JsonConfigurationSource { Path = "BasicConfig.json" } ;
339
- var configBuilder = new ConfigurationBuilder { Sources = { source } } ;
353
+ var configBuilder = new ConfigurationBuilder ( ) ;
354
+
355
+ configBuilder . AddInMemoryCollection ( [
356
+ new ( "HybridOne:DistributedCacheServiceKey" , "DistributedOne" ) ,
357
+ new ( "HybridTwo:DistributedCacheServiceKey" , "DistributedTwo" )
358
+ ] ) ;
359
+
340
360
var config = configBuilder . Build ( ) ;
341
361
342
362
var services = new ServiceCollection ( ) ;
@@ -368,8 +388,13 @@ public void CanCreateKeyedServicesWithKeyedDistributedCaches_UsingSetupActions()
368
388
[ Fact ]
369
389
public void CanCreateKeyedServicesWithKeyedDistributedCaches_UsingNamedOptionsAndSetupActions ( )
370
390
{
371
- var source = new JsonConfigurationSource { Path = "BasicConfig.json" } ;
372
- var configBuilder = new ConfigurationBuilder { Sources = { source } } ;
391
+ var configBuilder = new ConfigurationBuilder ( ) ;
392
+
393
+ configBuilder . AddInMemoryCollection ( [
394
+ new ( "HybridOne:DistributedCacheServiceKey" , "DistributedOne" ) ,
395
+ new ( "HybridTwo:DistributedCacheServiceKey" , "DistributedTwo" )
396
+ ] ) ;
397
+
373
398
var config = configBuilder . Build ( ) ;
374
399
375
400
var services = new ServiceCollection ( ) ;
0 commit comments