public void HasColumnType_evaluates_preconditions()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration();
            var config      = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var ex = Assert.Throws <ArgumentException>(
                () => config.HasColumnType(""));

            Assert.Equal(Strings.ArgumentIsNullOrWhitespace("columnType"), ex.Message);
        }
        public void HasColumnType_configures_when_unset()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration();
            var config      = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasColumnType("int");

            Assert.Equal("int", innerConfig.ColumnType);
            Assert.Same(config, result);
        }
Ejemplo n.º 3
0
        public void Methods_dont_throw_if_configuration_is_null()
        {
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => null);

            config.HasColumnName("Column1");
            config.HasColumnOrder(0);
            config.HasColumnType("int");
            config.HasParameterName("Parameter1");
            config.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            config.HasMaxLength(1);
            config.HasPrecision(1);
            config.HasPrecision(1, 1);
            config.IsConcurrencyToken(false);
            config.IsOptional();
            config.IsRequired();
            config.IsUnicode();
            config.IsVariableLength();
            config.IsFixedLength();
            config.IsMaxLength();
            config.IsRowVersion();
            config.IsKey();
        }
        public void Methods_dont_throw_if_configuration_is_null()
        {
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => null);

            config.HasColumnName("Column1");
            config.HasColumnOrder(0);
            config.HasColumnType("int");
            config.HasParameterName("Parameter1");
            config.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            config.HasMaxLength(1);
            config.HasPrecision(1);
            config.HasPrecision(1, 1);
            config.IsConcurrencyToken(false);
            config.IsOptional();
            config.IsRequired();
            config.IsUnicode();
            config.IsVariableLength();
            config.IsFixedLength();
            config.IsMaxLength();
            config.IsRowVersion();
            config.IsKey();
            config.HasColumnAnnotation("Fox", "Like an angel in disguise");
        }
        public void HasColumnType_evaluates_preconditions()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration();
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var ex = Assert.Throws<ArgumentException>(
                () => config.HasColumnType(""));

            Assert.Equal(Strings.ArgumentIsNullOrWhitespace("columnType"), ex.Message);
        }
        public void HasColumnType_is_noop_when_set()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration
                {
                    ColumnType = "int"
                };
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasColumnType("long");

            Assert.Equal("int", innerConfig.ColumnType);
            Assert.Same(config, result);
        }