private DateTimePropertyConfiguration(DateTimePropertyConfiguration source)
            : base(source)
        {
            DebugCheck.NotNull(source);

            Precision = source.Precision;
        }
Example #2
0
        internal override bool IsCompatible(
            PrimitivePropertyConfiguration other,
            bool inCSpace,
            out string errorMessage)
        {
            DateTimePropertyConfiguration other1 = other as DateTimePropertyConfiguration;
            bool flag1 = base.IsCompatible(other, inCSpace, out errorMessage);
            int  num;

            if (other1 != null)
            {
                num = this.IsCompatible <byte, DateTimePropertyConfiguration>((Expression <Func <DateTimePropertyConfiguration, byte?> >)(c => c.Precision), other1, ref errorMessage) ? 1 : 0;
            }
            else
            {
                num = 1;
            }
            bool flag2 = num != 0;

            if (flag1)
            {
                return(flag2);
            }
            return(false);
        }
        private DateTimePropertyConfiguration(DateTimePropertyConfiguration source)
            : base(source)
        {
            Contract.Requires(source != null);

            Precision = source.Precision;
        }
        private DateTimePropertyConfiguration(DateTimePropertyConfiguration source)
            : base(source)
        {
            DebugCheck.NotNull(source);

            Precision = source.Precision;
        }
        public void HasPrecision_with_scale_throws_on_DateTime()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration();
            var config      = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            Assert.Equal(
                Strings.LightweightPrimitivePropertyConfiguration_DateTimeScale("P"),
                Assert.Throws <InvalidOperationException>(() => config.HasPrecision(8, 2)).Message);
        }
        public void IsUnicode_throws_when_not_string()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration();
            var config      = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            Assert.Equal(
                Strings.LightweightPrimitivePropertyConfiguration_IsUnicodeNonString("P"),
                Assert.Throws <InvalidOperationException>(() => config.IsUnicode()).Message);
        }
Example #7
0
        public void HasPrecision_configures_when_unset()
        {
            var innerConfig = new DateTimePropertyConfiguration();
            var config      = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasPrecision(8);

            Assert.Equal <byte?>(8, innerConfig.Precision);
            Assert.Same(config, result);
        }
        public void Cloning_a_date_time_property_configuration_clones_its_property_information()
        {
            var configuration = new DateTimePropertyConfiguration();

            configuration.Precision = 100;

            var clone = (DateTimePropertyConfiguration)
                        Cloning_a_primitive_property_configuration_clones_its_property_information_implementation(configuration);

            Assert.Equal(100, clone.Precision.Value);
        }
Example #9
0
        internal override void CopyFrom(PrimitivePropertyConfiguration other)
        {
            base.CopyFrom(other);
            DateTimePropertyConfiguration propertyConfiguration = other as DateTimePropertyConfiguration;

            if (propertyConfiguration == null)
            {
                return;
            }
            this.Precision = propertyConfiguration.Precision;
        }
        public void HasPrecision_is_noop_when_set()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration
            {
                Precision = 8
            };
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasPrecision(7);

            Assert.Equal <byte?>(8, innerConfig.Precision);
            Assert.Same(config, result);
        }
Example #11
0
        internal override void MakeCompatibleWith(PrimitivePropertyConfiguration other, bool inCSpace)
        {
            base.MakeCompatibleWith(other, inCSpace);
            DateTimePropertyConfiguration propertyConfiguration = other as DateTimePropertyConfiguration;

            if (propertyConfiguration == null)
            {
                return;
            }
            byte?precision = propertyConfiguration.Precision;

            if (!(precision.HasValue ? new int?((int)precision.GetValueOrDefault()) : new int?()).HasValue)
            {
                return;
            }
            this.Precision = new byte?();
        }
Example #12
0
        internal override void FillFrom(PrimitivePropertyConfiguration other, bool inCSpace)
        {
            base.FillFrom(other, inCSpace);
            DateTimePropertyConfiguration propertyConfiguration = other as DateTimePropertyConfiguration;

            if (propertyConfiguration == null)
            {
                return;
            }
            byte?precision = this.Precision;

            if ((precision.HasValue ? new int?((int)precision.GetValueOrDefault()) : new int?()).HasValue)
            {
                return;
            }
            this.Precision = propertyConfiguration.Precision;
        }
        public void HasPrecision_with_scale_throws_on_DateTime()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration();
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            Assert.Equal(
                Strings.LightweightPrimitivePropertyConfiguration_DateTimeScale("P"),
                Assert.Throws<InvalidOperationException>(() => config.HasPrecision(8, 2)).Message);
        }
        public void HasPrecision_is_noop_when_set()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration
                {
                    Precision = 8
                };
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasPrecision(7);

            Assert.Equal<byte?>(8, innerConfig.Precision);
            Assert.Same(config, result);
        }
        public void IsUnicode_throws_when_not_string()
        {
            var innerConfig = new Properties.Primitive.DateTimePropertyConfiguration();
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            Assert.Equal(
               Strings.LightweightPrimitivePropertyConfiguration_IsUnicodeNonString("P"),
               Assert.Throws<InvalidOperationException>(() => config.IsUnicode()).Message);
        }
 internal DateTimePropertyConfiguration(Properties.Primitive.DateTimePropertyConfiguration configuration)
     : base(configuration)
 {
 }
        public void HasPrecision_configures_when_unset()
        {
            var innerConfig = new DateTimePropertyConfiguration();
            var config = new LightweightPropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasPrecision(8);

            Assert.Equal<byte?>(8, innerConfig.Precision);
            Assert.Same(config, result);
        }
Example #18
0
 private DateTimePropertyConfiguration(DateTimePropertyConfiguration source)
     : base((PrimitivePropertyConfiguration)source)
 {
     this.Precision = source.Precision;
 }