@@ -46,6 +46,45 @@ public void Redis_WithoutSerializer_ShouldThrow()
4646#endif
4747
4848 [ Fact ]
49+ [ Trait ( "category" , "Redis" ) ]
50+ public void Redis_Extensions_WithClient ( )
51+ {
52+ var configKey = Guid . NewGuid ( ) . ToString ( ) ;
53+ var client = ConnectionMultiplexer . Connect ( "localhost" ) ;
54+ var cache = CacheFactory . Build < string > (
55+ s => s
56+ . WithRedisConfiguration ( configKey , client )
57+ . WithRedisCacheHandle ( configKey ) ) ;
58+
59+ var handle = cache . CacheHandles . OfType < RedisCacheHandle < string > > ( ) . First ( ) ;
60+ var cfg = RedisConfigurations . GetConfiguration ( configKey ) ;
61+
62+ Assert . Equal ( handle . Configuration . Name , configKey ) ;
63+ Assert . Equal ( 0 , cfg . Database ) ;
64+ Assert . Equal ( "localhost:6379" , cfg . ConnectionString ) ;
65+ }
66+
67+ [ Fact ]
68+ [ Trait ( "category" , "Redis" ) ]
69+ public void Redis_Extensions_WithClientWithDb ( )
70+ {
71+ var configKey = Guid . NewGuid ( ) . ToString ( ) ;
72+ var client = ConnectionMultiplexer . Connect ( "localhost" ) ;
73+ var cache = CacheFactory . Build < string > (
74+ s => s
75+ . WithRedisConfiguration ( configKey , client , 23 )
76+ . WithRedisCacheHandle ( configKey ) ) ;
77+
78+ var handle = cache . CacheHandles . OfType < RedisCacheHandle < string > > ( ) . First ( ) ;
79+ var cfg = RedisConfigurations . GetConfiguration ( configKey ) ;
80+
81+ Assert . Equal ( handle . Configuration . Name , configKey ) ;
82+ Assert . Equal ( 23 , cfg . Database ) ;
83+ Assert . Equal ( "localhost:6379" , cfg . ConnectionString ) ;
84+ }
85+
86+ [ Fact ]
87+ [ Trait ( "category" , "Redis" ) ]
4988 public void Redis_BackplaneEvents_Add ( )
5089 {
5190 var key = Guid . NewGuid ( ) . ToString ( ) ;
@@ -76,12 +115,13 @@ public void Redis_BackplaneEvents_Add()
76115 [ Trait ( "category" , "Redis" ) ]
77116 public void Redis_ValidateVersion_AddPutGetUpdate ( )
78117 {
118+ var configKey = Guid . NewGuid ( ) . ToString ( ) ;
79119 var multi = ConnectionMultiplexer . Connect ( "localhost" ) ;
80120 var cache = CacheFactory . Build < Poco > (
81121 s => s
82- . WithRedisConfiguration ( "redis" , multi )
122+ . WithRedisConfiguration ( configKey , multi )
83123 . WithJsonSerializer ( )
84- . WithRedisCacheHandle ( "redis" ) ) ;
124+ . WithRedisCacheHandle ( configKey ) ) ;
85125
86126 // act/assert
87127 using ( cache )
0 commit comments