1
1
using Enyim . Caching ;
2
2
using Enyim . Caching . Memcached ;
3
- using Enyim . Caching . Memcached . Transcoders ;
4
3
using Microsoft . Extensions . DependencyInjection ;
5
4
using Microsoft . Extensions . Logging ;
6
5
using System ;
@@ -17,7 +16,7 @@ public abstract class MemcachedClientTest
17
16
private static readonly ILog _log = LogManager . GetLogger ( typeof ( MemcachedClientTest ) ) ;
18
17
public const string TestObjectKey = "Hello_World" ;
19
18
20
- protected virtual MemcachedClient GetClient ( MemcachedProtocol protocol = MemcachedProtocol . Binary , bool useBinaryFormatterTranscoder = false )
19
+ protected virtual MemcachedClient GetClient ( MemcachedProtocol protocol = MemcachedProtocol . Binary )
21
20
{
22
21
IServiceCollection services = new ServiceCollection ( ) ;
23
22
services . AddEnyimMemcached ( options =>
@@ -26,10 +25,6 @@ protected virtual MemcachedClient GetClient(MemcachedProtocol protocol = Memcach
26
25
options . Protocol = protocol ;
27
26
// options.Transcoder = "MessagePackTranscoder";
28
27
} ) ;
29
- if ( useBinaryFormatterTranscoder )
30
- {
31
- services . AddSingleton < ITranscoder , BinaryFormatterTranscoder > ( ) ;
32
- }
33
28
34
29
services . AddLogging ( builder => builder . SetMinimumLevel ( LogLevel . Warning ) . AddConsole ( ) ) ;
35
30
@@ -66,11 +61,6 @@ public async Task StoreObjectTest()
66
61
{
67
62
Assert . True ( await client . StoreAsync ( StoreMode . Set , TestObjectKey , td , DateTime . Now . AddSeconds ( 5 ) ) ) ;
68
63
}
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
- }
74
64
}
75
65
76
66
[ Fact ]
@@ -94,18 +84,6 @@ public void GetObjectTest()
94
84
Assert . Equal ( 19810619 , td2 . FieldC ) ;
95
85
Assert . True ( td2 . FieldD , "Object was corrupted." ) ;
96
86
}
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
- }
109
87
}
110
88
111
89
[ Fact ]
0 commit comments