11using Enyim . Caching ;
22using Enyim . Caching . Memcached ;
3- using Enyim . Caching . Memcached . Transcoders ;
43using Microsoft . Extensions . DependencyInjection ;
54using Microsoft . Extensions . Logging ;
65using System ;
@@ -17,7 +16,7 @@ public abstract class MemcachedClientTest
1716 private static readonly ILog _log = LogManager . GetLogger ( typeof ( MemcachedClientTest ) ) ;
1817 public const string TestObjectKey = "Hello_World" ;
1918
20- protected virtual MemcachedClient GetClient ( MemcachedProtocol protocol = MemcachedProtocol . Binary , bool useBinaryFormatterTranscoder = false )
19+ protected virtual MemcachedClient GetClient ( MemcachedProtocol protocol = MemcachedProtocol . Binary )
2120 {
2221 IServiceCollection services = new ServiceCollection ( ) ;
2322 services . AddEnyimMemcached ( options =>
@@ -26,10 +25,6 @@ protected virtual MemcachedClient GetClient(MemcachedProtocol protocol = Memcach
2625 options . Protocol = protocol ;
2726 // options.Transcoder = "MessagePackTranscoder";
2827 } ) ;
29- if ( useBinaryFormatterTranscoder )
30- {
31- services . AddSingleton < ITranscoder , BinaryFormatterTranscoder > ( ) ;
32- }
3328
3429 services . AddLogging ( builder => builder . SetMinimumLevel ( LogLevel . Warning ) . AddConsole ( ) ) ;
3530
@@ -66,11 +61,6 @@ public async Task StoreObjectTest()
6661 {
6762 Assert . True ( await client . StoreAsync ( StoreMode . Set , TestObjectKey , td , DateTime . Now . AddSeconds ( 5 ) ) ) ;
6863 }
69-
70- using ( MemcachedClient client = GetClient ( MemcachedProtocol . Binary , true ) )
71- {
72- Assert . True ( await client . StoreAsync ( StoreMode . Set , TestObjectKey , td , DateTime . Now . AddSeconds ( 5 ) ) ) ;
73- }
7464 }
7565
7666 [ Fact ]
@@ -94,18 +84,6 @@ public void GetObjectTest()
9484 Assert . Equal ( 19810619 , td2 . FieldC ) ;
9585 Assert . True ( td2 . FieldD , "Object was corrupted." ) ;
9686 }
97-
98- using ( MemcachedClient client = GetClient ( MemcachedProtocol . Binary , true ) )
99- {
100- Assert . True ( client . Store ( StoreMode . Set , TestObjectKey , td ) , "Initialization failed." ) ;
101- TestData td2 = client . Get < TestData > ( TestObjectKey ) ;
102-
103- Assert . NotNull ( td2 ) ;
104- Assert . Equal ( "Hello" , td2 . FieldA ) ;
105- Assert . Equal ( "World" , td2 . FieldB ) ;
106- Assert . Equal ( 19810619 , td2 . FieldC ) ;
107- Assert . True ( td2 . FieldD , "Object was corrupted." ) ;
108- }
10987 }
11088
11189 [ Fact ]
0 commit comments