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

            Assert.Equal(
                "columnOrder",
                Assert.Throws <ArgumentOutOfRangeException>(() => config.HasColumnOrder(-1)).ParamName);
        }
        public void HasColumnOrder_configures_when_unset()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration();
            var config      = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasColumnOrder(1);

            Assert.Equal(1, innerConfig.ColumnOrder);
            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 HasColumnOrder_is_noop_when_set()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration
                {
                    ColumnOrder = 1
                };
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            var result = config.HasColumnOrder(2);

            Assert.Equal(1, innerConfig.ColumnOrder);
            Assert.Same(config, result);
        }
        public void HasColumnOrder_throws_on_negative_arguments()
        {
            var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration();
            var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig);

            Assert.Equal(
                "columnOrder",
                Assert.Throws<ArgumentOutOfRangeException>(() => config.HasColumnOrder(-1)).ParamName);
        }