public void ConversionToStringTest()
        {
            var stringTypeInfo = new StorageTypeInfo(typeof(string), null, 100);
            var typeList       = new[] {
                typeof(string),
                typeof(short),
                typeof(int),
                typeof(long),
                typeof(ushort),
                typeof(uint),
                typeof(ulong),
                typeof(char),
                typeof(byte),
                typeof(sbyte)
            };

            foreach (var type in typeList)
            {
                Assert.IsTrue(TypeConversionVerifier
                              .CanConvert(new StorageTypeInfo(type, null), stringTypeInfo));
            }
            typeList = new[] {
                typeof(Guid),
                typeof(DateTime),
                typeof(TimeSpan),
                typeof(byte[])
            };
            foreach (var type in typeList)
            {
                Assert.IsFalse(TypeConversionVerifier
                               .CanConvert(new StorageTypeInfo(type, null), stringTypeInfo));
            }
        }
        public void ConversionToStringTest()
        {
            var stringTypeInfo = new StorageTypeInfo(typeof(String), null, 100);
            var typeList       = new[] {
                typeof(String),
                typeof(Int16),
                typeof(Int32),
                typeof(Int64),
                typeof(UInt16),
                typeof(UInt32),
                typeof(UInt64),
                typeof(Char),
                typeof(Byte),
                typeof(SByte)
            };

            foreach (var type in typeList)
            {
                Assert.IsTrue(TypeConversionVerifier
                              .CanConvert(new StorageTypeInfo(type, null), stringTypeInfo));
            }
            typeList = new[] {
                typeof(Guid),
                typeof(DateTime),
                typeof(TimeSpan),
                typeof(Byte[])
            };
            foreach (var type in typeList)
            {
                Assert.IsFalse(TypeConversionVerifier
                               .CanConvert(new StorageTypeInfo(type, null), stringTypeInfo));
            }
        }
        public void CanConvertSafelyTest()
        {
            var sourceType = new StorageTypeInfo(typeof(string), null, 10);
            var targetType = new StorageTypeInfo(typeof(string), null, 5);

            Assert.IsTrue(TypeConversionVerifier.CanConvert(sourceType, targetType));
            Assert.IsFalse(TypeConversionVerifier.CanConvertSafely(sourceType, targetType));
            targetType = new StorageTypeInfo(typeof(string), null, 10);
            Assert.IsTrue(TypeConversionVerifier.CanConvertSafely(sourceType, targetType));
            targetType = new StorageTypeInfo(typeof(string), null, 11);
            Assert.IsTrue(TypeConversionVerifier.CanConvertSafely(sourceType, targetType));
        }
        public void CanConvertNullableTest()
        {
            var nullableDefinition   = typeof(Nullable <>);
            var supportedConversions = CreateSupportedConversions();
            var typeList             = CreateTypeList();

            foreach (var type in typeList.Where(t => t.IsValueType))
            {
                Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(type, null), new StorageTypeInfo(type, null)));
                if (supportedConversions.ContainsKey(type))
                {
                    foreach (var targetType in typeList.Where(t => t != type && t.IsValueType))
                    {
                        var nullableSource = nullableDefinition.MakeGenericType(type);
                        var nullableTarget = nullableDefinition.MakeGenericType(targetType);
                        if (supportedConversions[type].Contains(targetType))
                        {
                            Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(nullableSource, null),
                                                                            new StorageTypeInfo(nullableTarget, null)));
                            Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(nullableSource, null),
                                                                            new StorageTypeInfo(targetType, null)));
                            Assert.IsFalse(TypeConversionVerifier.CanConvertSafely(new StorageTypeInfo(nullableSource, null),
                                                                                   new StorageTypeInfo(targetType, null)));
                            Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(type, null),
                                                                            new StorageTypeInfo(nullableTarget, null)));
                        }
                        else
                        {
                            Assert.IsFalse(TypeConversionVerifier.CanConvert(
                                               new StorageTypeInfo(nullableDefinition.MakeGenericType(type), null),
                                               new StorageTypeInfo(nullableDefinition.MakeGenericType(targetType), null)));
                        }
                    }
                }
            }
        }
        public void CanConvertTest()
        {
            var supportedConversions = CreateSupportedConversions();
            var typeList             = CreateTypeList();

            foreach (var type in typeList)
            {
                Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(type, null), new StorageTypeInfo(type, null)));
                if (supportedConversions.ContainsKey(type))
                {
                    foreach (var targetType in typeList.Where(t => t != type))
                    {
                        if (supportedConversions[type].Contains(targetType))
                        {
                            Assert.IsTrue(TypeConversionVerifier.CanConvert(new StorageTypeInfo(type, null), new StorageTypeInfo(targetType, null)));
                        }
                        else
                        {
                            Assert.IsFalse(TypeConversionVerifier.CanConvert(new StorageTypeInfo(type, null), new StorageTypeInfo(targetType, null)));
                        }
                    }
                }
            }
        }