Skip to content

Commit 32d2a8e

Browse files
committed
Adding some tests for non known types, MichaCo#125
1 parent 3b3bc02 commit 32d2a8e

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/CacheManager.Tests/MicrosoftConfigurationTests.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,24 @@ public void Configuration_CacheHandle_KnownType_MemcachedB()
465465
config.CacheHandleConfigurations[0].Name.Should().Be("name");
466466
config.CacheHandleConfigurations[0].Key.Should().Be("name"); // now key gets set to name
467467
}
468+
469+
[Fact]
470+
public void Configuration_CacheHandle_Type_MemcachedB()
471+
{
472+
var data = new Dictionary<string, string>
473+
{
474+
{"cacheManagers:0:name", "name"},
475+
{"cacheManagers:0:handles:0:type", "CacheManager.Memcached.MemcachedCacheHandle`1, CacheManager.Memcached"},
476+
{"cacheManagers:0:handles:0:name", "name"},
477+
};
478+
479+
var config = GetConfiguration(data).GetCacheConfiguration("name");
480+
config.Name.Should().Be("name");
481+
config.CacheHandleConfigurations.Count.Should().Be(1);
482+
config.CacheHandleConfigurations[0].HandleType.Should().Be(typeof(Memcached.MemcachedCacheHandle<>));
483+
config.CacheHandleConfigurations[0].Name.Should().Be("name");
484+
config.CacheHandleConfigurations[0].Key.Should().Be("name"); // now key gets set to name
485+
}
468486

469487
[Fact]
470488
public void Configuration_CacheHandle_KnownType_Web()
@@ -934,6 +952,20 @@ public void Configuration_Serializer_KnownType_Protobuf()
934952
config.SerializerType.Should().Be(typeof(Serialization.ProtoBuf.ProtoBufSerializer));
935953
}
936954

955+
[Fact]
956+
public void Configuration_Serializer_Type_Protobuf()
957+
{
958+
var data = new Dictionary<string, string>
959+
{
960+
{"cacheManagers:0:name", "name"},
961+
{"cacheManagers:0:handles:0:knownType", "Dictionary"},
962+
{"cacheManagers:0:serializer:type", "CacheManager.Serialization.ProtoBuf.ProtoBufSerializer, CacheManager.Serialization.ProtoBuf"}
963+
};
964+
965+
var config = GetConfiguration(data).GetCacheConfiguration("name");
966+
config.SerializerType.Should().Be(typeof(Serialization.ProtoBuf.ProtoBufSerializer));
967+
}
968+
937969
[Fact]
938970
public void Configuration_Redis_NothingDefined()
939971
{

0 commit comments

Comments
 (0)