public virtual void Create_and_clone_sized_mappings_with_converter(Type mappingType, Type clrType)
        {
            var mapping = (RelationalTypeMapping)Activator.CreateInstance(
                mappingType,
                BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance,
                null,
                new[] { FakeTypeMapping.CreateParameters(clrType, size: 33, fixedLength: true) },
                null,
                null);

            var clone = mapping.Clone("<clone>", 66);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<original>", mapping.StoreType);
            Assert.Equal("<clone>", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Equal(33, mapping.Size);
            Assert.Equal(66, clone.Size);
            Assert.NotNull(mapping.Converter);
            Assert.Same(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.True(mapping.IsFixedLength);
            Assert.True(clone.IsFixedLength);

            var newConverter = new FakeValueConverter();

            clone = (RelationalTypeMapping)mapping.Clone(newConverter);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<original>", mapping.StoreType);
            Assert.Equal("<original>", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Equal(33, mapping.Size);
            Assert.Equal(33, clone.Size);
            Assert.NotSame(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.True(mapping.IsFixedLength);
            Assert.True(clone.IsFixedLength);
        }
        public virtual void Create_and_clone_with_converter(Type mappingType, Type type)
        {
            var mapping = (RelationalTypeMapping)Activator.CreateInstance(
                mappingType,
                BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance,
                null,
                new[] { FakeTypeMapping.CreateParameters(type) },
                null,
                null);

            var clone = mapping.Clone("<clone>", null);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<clone>", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Null(clone.Size);
            Assert.NotNull(mapping.Converter);
            Assert.Same(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.Equal(StoreTypePostfix.PrecisionAndScale, clone.StoreTypePostfix);

            var newConverter = new FakeValueConverter();

            clone = (RelationalTypeMapping)mapping.Clone(newConverter);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<original>", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Null(clone.Size);
            Assert.NotSame(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.Equal(StoreTypePostfix.PrecisionAndScale, clone.StoreTypePostfix);
        }
        protected virtual void UnicodeConversionCloneTest(
            Type mappingType,
            Type type,
            params object[] additionalArgs)
        {
            var mapping = (RelationalTypeMapping)Activator.CreateInstance(
                mappingType,
                BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.CreateInstance,
                null,
                new[]
            {
                FakeTypeMapping.CreateParameters(
                    type,
                    size: 33,
                    unicode: false,
                    fixedLength: true,
                    storeTypePostfix: StoreTypePostfix.Size)
            }.Concat(additionalArgs).ToArray(),
                null,
                null);

            var clone = mapping.Clone("<clone>", 66);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<original>(33)", mapping.StoreType);
            Assert.Equal("<clone>(66)", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Equal(33, mapping.Size);
            Assert.Equal(66, clone.Size);
            Assert.False(mapping.IsUnicode);
            Assert.False(clone.IsUnicode);
            Assert.NotNull(mapping.Converter);
            Assert.Same(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.True(mapping.IsFixedLength);
            Assert.True(clone.IsFixedLength);
            Assert.Equal(StoreTypePostfix.Size, clone.StoreTypePostfix);

            var newConverter = new FakeValueConverter();

            clone = (RelationalTypeMapping)mapping.Clone(newConverter);

            Assert.NotSame(mapping, clone);
            Assert.Same(mapping.GetType(), clone.GetType());
            Assert.Equal("<original>(33)", mapping.StoreType);
            Assert.Equal("<original>(33)", clone.StoreType);
            Assert.Equal(DbType.VarNumeric, clone.DbType);
            Assert.Equal(33, mapping.Size);
            Assert.Equal(33, clone.Size);
            Assert.False(mapping.IsUnicode);
            Assert.False(clone.IsUnicode);
            Assert.NotSame(mapping.Converter, clone.Converter);
            Assert.Same(mapping.Comparer, clone.Comparer);
            Assert.Same(mapping.KeyComparer, clone.KeyComparer);
            Assert.Same(typeof(object), clone.ClrType);
            Assert.True(mapping.IsFixedLength);
            Assert.True(clone.IsFixedLength);
            Assert.Equal(StoreTypePostfix.Size, clone.StoreTypePostfix);
        }