예제 #1
0
        public void ConvertTypeWithCustomConverter()
        {
            RedisValueConverter.RegisterConverter(new MockCustomerConverter());

            RedisValue redisVal;
            Guid       guid = Convert(Guid.NewGuid(), out redisVal);

            Assert.AreEqual(MockCustomerConverter.MockGuidValue, guid);
            Assert.AreEqual(MockCustomerConverter.MockRedisValue, redisVal);

            RedisValueConverter.UnregisterConverter <Guid>();
        }
예제 #2
0
        public void CheckConvertable()
        {
            RedisValueConverter.RegisterConverter(typeof(object), new MockCustomerConverter());
            Assert.IsTrue(RedisValueConverter.IsConvertable <int>());
            Assert.IsTrue(RedisValueConverter.IsConvertable <int?>());
            Assert.IsTrue(RedisValueConverter.IsConvertable <TestEnum>());
            Assert.IsTrue(RedisValueConverter.IsConvertable <TestEnum?>());
            Assert.IsTrue(RedisValueConverter.IsConvertable <object>());

            RedisValueConverter.UnregisterConverter <object>();
            Assert.IsFalse(RedisValueConverter.IsConvertable <object>());
        }