public void HasDatabaseGeneratedOption_configures_when_unset() { var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration(); var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig); var result = config.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed); Assert.Equal(DatabaseGeneratedOption.Computed, innerConfig.DatabaseGeneratedOption); Assert.Same(config, result); }
public void HasDatabaseGeneratedOption_evaluates_preconditions() { var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration(); var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig); var ex = Assert.Throws <ArgumentOutOfRangeException>( () => config.HasDatabaseGeneratedOption((DatabaseGeneratedOption)(-1))); Assert.Equal("databaseGeneratedOption", ex.ParamName); }
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 HasDatabaseGeneratedOption_is_noop_when_set() { var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration { DatabaseGeneratedOption = DatabaseGeneratedOption.Computed }; var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig); var result = config.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity); Assert.Equal(DatabaseGeneratedOption.Computed, innerConfig.DatabaseGeneratedOption); Assert.Same(config, result); }
public void HasDatabaseGeneratedOption_evaluates_preconditions() { var innerConfig = new Properties.Primitive.PrimitivePropertyConfiguration(); var config = new ConventionPrimitivePropertyConfiguration(new MockPropertyInfo(), () => innerConfig); var ex = Assert.Throws<ArgumentOutOfRangeException>( () => config.HasDatabaseGeneratedOption((DatabaseGeneratedOption)(-1))); Assert.Equal("databaseGeneratedOption", ex.ParamName); }