internal ConventionTypeConfiguration( Type type, Func <ComplexTypeConfiguration> complexTypeConfiguration, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration) { this._configuration = new ConventionTypeConfiguration(type, complexTypeConfiguration, modelConfiguration); }
public void ClrType_returns_type() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Same(type.Object, config.ClrType); }
internal ConventionTypeConfiguration( Type type, ModelConfiguration modelConfiguration) { VerifyType(type); _configuration = new ConventionTypeConfiguration(type, modelConfiguration); }
internal ConventionTypeConfiguration( Type type, Func <EntityTypeConfiguration> entityTypeConfiguration, ModelConfiguration modelConfiguration) { VerifyType(type); _configuration = new ConventionTypeConfiguration(type, entityTypeConfiguration, modelConfiguration); }
internal ConventionTypeConfiguration( Type type, Func <ComplexTypeConfiguration> complexTypeConfiguration, ModelConfiguration modelConfiguration) { VerifyType(type); _configuration = new ConventionTypeConfiguration(type, complexTypeConfiguration, modelConfiguration); }
public void HasKey_throws_when_not_exists() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("Property2", "T"), Assert.Throws <InvalidOperationException>(() => config.HasKey("Property2")).Message); }
public void MapToStoredProcedures_with_no_args_should_add_configuration() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.MapToStoredProcedures(); Assert.NotNull(innerConfig.ModificationStoredProceduresConfiguration); }
public void HasEntitySetName_configures() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.HasEntitySetName("foo"); Assert.Equal("foo", innerConfig.EntitySetName); }
public void Ignore_type_configures() { var type = typeof(LocalEntityType); var innerConfig = new ModelConfiguration(); var config = new ConventionTypeConfiguration(type, innerConfig); config.Ignore(); Assert.True(innerConfig.IsIgnoredType(typeof(LocalEntityType))); }
public void Ignore_throws_when_property_not_found() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("foo", type.Name), Assert.Throws <InvalidOperationException>(() => config.Ignore("foo")).Message); }
public void IsComplexType_configures() { var type = typeof(LocalEntityType); var innerConfig = new ModelConfiguration(); var config = new ConventionTypeConfiguration<LocalEntityType>(type, innerConfig); config.IsComplexType(); Assert.True(innerConfig.IsComplexType(typeof(LocalEntityType))); }
public void ToTable_configures_when_unset() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Table1"); Assert.Equal("Table1", innerConfig.TableName); }
public void ToTable_with_schema_configures() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.ToTable("foo", "bar"); Assert.Equal("foo", innerConfig.TableName); }
public void IsComplexType_configures() { var type = typeof(LocalEntityType); var innerConfig = new ModelConfiguration(); var config = new ConventionTypeConfiguration <LocalEntityType>(type, innerConfig); config.IsComplexType(); Assert.True(innerConfig.IsComplexType(typeof(LocalEntityType))); }
public void HasKey_composite_throws_when_not_exists() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("DoesNotExist1", "AType"), Assert.Throws <InvalidOperationException>(() => config.HasKey(new[] { "DoesNotExist1", "DoesNotExist2" })).Message); }
public void MapToStoredProcedures_configures_when_unset() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.MapToStoredProcedures(); Assert.NotNull(innerConfig.ModificationStoredProceduresConfiguration); }
public void MapToStoredProcedures_with_no_args_should_add_configuration() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.MapToStoredProcedures(); Assert.True(innerConfig.ModificationStoredProceduresConfiguration != null); }
public void HasEntitySetName_configures_when_unset() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasEntitySetName("EntitySet1"); Assert.Equal("EntitySet1", innerConfig.EntitySetName); Assert.Same(config, result); }
public void HasEntitySetName_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws <ArgumentException>( () => config.HasEntitySetName(null)); Assert.Equal(Strings.ArgumentIsNullOrWhitespace("entitySetName"), ex.Message); }
public void Property_evaluates_preconditions() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration<object>(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws<ArgumentNullException>( () => config.Property<object>(null)); Assert.Equal("propertyExpression", ex.ParamName); }
public void HasKey_PropertyInfo_configures_when_unset() { var innerConfig = new EntityTypeConfiguration(typeof(AType2)); var config = new ConventionTypeConfiguration(typeof(AType2), () => innerConfig, new ModelConfiguration()); var result = config.HasKey(config.ClrType.GetRuntimeProperties().First(p => p.IsPublic())) .HasKey(config.ClrType.GetRuntimeProperties().Last(p => p.IsPublic())); Assert.Equal(new[] { "Property1", "Property2" }, innerConfig.KeyProperties.Select(p => p.Name)); Assert.Same(config, result); }
public void HasKey_configures_with_private_property() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey("Property1").HasKey("Property3"); Assert.Equal(new[] { "Property1", "Property3" }, innerConfig.KeyProperties.Select(p => p.Name)); Assert.Same(config, result); }
public void HasEntitySetName_configures_when_unset() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasEntitySetName("EntitySet1"); Assert.Equal("EntitySet1", innerConfig.EntitySetName); Assert.Same(config, result); }
public void ToTable_handles_dot() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Schema1.Table1"); Assert.Equal("Schema1", innerConfig.SchemaName); Assert.Equal("Table1", innerConfig.TableName); }
public void Property_evaluates_preconditions() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <object>(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws <ArgumentNullException>( () => config.Property <object>(null)); Assert.Equal("propertyExpression", ex.ParamName); }
public void Ignore_configures_complex_type_properties() { var type = typeof(LocalEntityType); var innerConfig = new ComplexTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.Ignore(t => t.Property1); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1")); }
public void HasEntitySetName_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws<ArgumentException>( () => config.HasEntitySetName(null)); Assert.Equal(Strings.ArgumentIsNullOrWhitespace("entitySetName"), ex.Message); }
public void Ignore_configures_complex_type_properties() { var type = typeof(LocalEntityType); var innerConfig = new ComplexTypeConfiguration(type); var config = new ConventionTypeConfiguration<LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); config.Ignore(t => t.Property1); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1")); }
public void HasKey_configures_when_unset() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration <LocalEntityType>(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey(e => e.Property1); Assert.Equal(1, innerConfig.KeyProperties.Count()); Assert.True(innerConfig.KeyProperties.Any(p => p.Name == "Property1")); Assert.Same(config, result); }
public void Ignore_configures() { var type = new MockType() .Property <int>("Property1"); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.Ignore("Property1"); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1")); }
public void Ignore_configures_private_property() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.Ignore("Property3"); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property3")); }
public void HasKey_configures_when_unset() { var type = new MockType() .Property <int>("Property1") .Property <int>("Property2"); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey("Property1").HasKey("Property2"); Assert.Equal(new[] { "Property1", "Property2" }, innerConfig.KeyProperties.Select(p => p.Name)); Assert.Same(config, result); }
public void Property_throws_when_indexer() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws <InvalidOperationException>( () => config.Property("Item")); Assert.Equal( Strings.LightweightEntityConfiguration_NonScalarProperty("Item"), ex.Message); }
public void ToTable_with_schema_is_noop_when_set() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); innerConfig.ToTable("Table1", "Schema1"); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Table2", "Schema2"); Assert.Equal("Table1", innerConfig.TableName); Assert.Equal("Schema1", innerConfig.SchemaName); }
public void HasKey_composite_configures_with_private_property_when_unset() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey(new[] { "Property1", "Property3" }); Assert.Equal(2, innerConfig.KeyProperties.Count()); Assert.True(innerConfig.KeyProperties.Any(p => p.Name == "Property1")); Assert.True(innerConfig.KeyProperties.Any(p => p.Name == "Property3")); Assert.Same(config, result); }
public void HasKey_composite_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws<ArgumentNullException>( () => config.HasKey((string[])null)); Assert.Equal("propertyNames", ex.ParamName); Assert.Equal( Strings.CollectionEmpty("keyProperties", "HasKey"), Assert.Throws<ArgumentException>( () => config.HasKey(Enumerable.Empty<string>())).Message); }
public void ToTable_handles_dot() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Schema1.Table1"); Assert.Equal("Schema1", innerConfig.SchemaName); Assert.Equal("Table1", innerConfig.TableName); }
public void HasKey_PropertyInfo_configures_when_unset() { var innerConfig = new EntityTypeConfiguration(typeof(AType2)); var config = new ConventionTypeConfiguration(typeof(AType2), () => innerConfig, new ModelConfiguration()); var result = config.HasKey(config.ClrType.GetRuntimeProperties().First(p => p.IsPublic())) .HasKey(config.ClrType.GetRuntimeProperties().Last(p => p.IsPublic())); Assert.Equal(new[] { "Property1", "Property2" }, innerConfig.KeyProperties.Select(p => p.Name)); Assert.Same(config, result); }
public void HasKey_is_noop_when_set() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); innerConfig.Key(new[] { type.GetDeclaredProperty("Property1") }); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey("Property2"); Assert.Equal(1, innerConfig.KeyProperties.Count()); Assert.False(innerConfig.KeyProperties.Any(p => p.Name == "Property2")); Assert.Same(config, result); }
public void MapToStoredProcedures_with_action_should_invoke_and_add_configuration() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); ConventionModificationStoredProceduresConfiguration configuration = null; config.MapToStoredProcedures(c => configuration = c); Assert.Same( configuration.Configuration, innerConfig.ModificationStoredProceduresConfiguration); }
public void Property_throws_when_indexer() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var ex = Assert.Throws<InvalidOperationException>( () => config.Property("Item")); Assert.Equal( Strings.LightweightEntityConfiguration_NonScalarProperty("Item"), ex.Message); }
public void HasKey_composite_throws_when_not_exists() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("DoesNotExist1", "AType"), Assert.Throws<InvalidOperationException>(() => config.HasKey(new[] { "DoesNotExist1", "DoesNotExist2" })).Message); }
public void ClrType_returns_type() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Same(type.Object, config.ClrType); }
public void ToTable_configures_when_unset() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Table1"); Assert.Equal("Table1", innerConfig.TableName); }
public void HasKey_composite_configures_with_private_property_when_unset() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey(new[] { "Property1", "Property3" }); Assert.Equal(2, innerConfig.KeyProperties.Count()); Assert.True(innerConfig.KeyProperties.Any(p => p.Name == "Property1")); Assert.True(innerConfig.KeyProperties.Any(p => p.Name == "Property3")); Assert.Same(config, result); }
public void NavigationProperty_throws_when_property_not_found() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("foo", type.Name), Assert.Throws<InvalidOperationException>(() => config.NavigationProperty("foo")).Message); Assert.Equal( "propertyInfo", Assert.Throws<ArgumentNullException>(() => config.NavigationProperty((PropertyInfo)null)).ParamName); }
public void NavigationProperty_returns_configuration_by_name_for_private_property() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.NavigationProperty("PrivateNavigationProperty"); Assert.NotNull(result); Assert.NotNull(result.ClrPropertyInfo); Assert.Equal("PrivateNavigationProperty", result.ClrPropertyInfo.Name); Assert.Equal(typeof(LocalEntityType), result.ClrPropertyInfo.PropertyType); Assert.NotNull(result.Configuration); Assert.IsType<NavigationPropertyConfiguration>(result.Configuration); }
public void NavigationProperty_evaluates_preconditions() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("propertyName"), Assert.Throws<ArgumentException>( () => config.NavigationProperty((string)null)).Message); Assert.Equal( Strings.LightweightEntityConfiguration_InvalidNavigationProperty("Property1"), Assert.Throws<InvalidOperationException>( () => config.NavigationProperty(type.GetDeclaredProperty("Property1"))).Message); }
public void Property_returns_configuration_for_complex_type_properties() { var type = typeof(AType); var innerConfig = new ComplexTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.IsComplexType(); var result = config.Property("Property5"); Assert.NotNull(result); Assert.NotNull(result.ClrPropertyInfo); Assert.Equal("Property5", result.ClrPropertyInfo.Name); Assert.Equal(typeof(decimal), result.ClrPropertyInfo.PropertyType); Assert.NotNull(result.Configuration); Assert.IsType<Properties.Primitive.DecimalPropertyConfiguration>(result.Configuration()); }
public void Property_throws_when_not_exists() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("DoesNotExist", type.Name), Assert.Throws<InvalidOperationException>(() => config.Property("DoesNotExist")).Message); Assert.Equal( "propertyInfo", Assert.Throws<ArgumentNullException>(() => config.Property((PropertyInfo)null)).ParamName); }
public void HasKey_composite_is_noop_when_called_twice() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey(new[] { "Property1" }) .HasKey(new[] { "Property2", "Property4" }); Assert.Equal(1, innerConfig.KeyProperties.Count()); Assert.False(innerConfig.KeyProperties.Any(p => p.Name == "Property2")); Assert.False(innerConfig.KeyProperties.Any(p => p.Name == "Property4")); Assert.Same(config, result); }
public void Ignore_type_configures() { var type = typeof(LocalEntityType); var innerConfig = new ModelConfiguration(); var config = new ConventionTypeConfiguration(type, innerConfig); config.Ignore(); Assert.True(innerConfig.IsIgnoredType(typeof(LocalEntityType))); }
public void MapToStoredProcedures_configures_when_unset() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.MapToStoredProcedures(); Assert.NotNull(innerConfig.ModificationStoredProceduresConfiguration); }
public void Ignore_throws_when_property_not_found() { var type = typeof(LocalEntityType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.NoSuchProperty("foo", type.Name), Assert.Throws<InvalidOperationException>(() => config.Ignore("foo")).Message); }
public void MapToStoredProcedures_with_no_args_should_add_configuration() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.MapToStoredProcedures(); Assert.NotNull(innerConfig.ModificationStoredProceduresConfiguration); }
public void HasKey_configures_with_private_property() { var type = typeof(AType); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasKey("Property1").HasKey("Property3"); Assert.Equal(new[] { "Property1", "Property3" }, innerConfig.KeyProperties.Select(p => p.Name)); Assert.Same(config, result); }
public void HasAnnotation_evaluates_preconditions() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws<ArgumentException>(() => config.HasTableAnnotation(null, null)).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws<ArgumentException>(() => config.HasTableAnnotation(" ", null)).Message); Assert.Equal( Strings.BadAnnotationName("Cheese:Pickle"), Assert.Throws<ArgumentException>(() => config.HasTableAnnotation("Cheese:Pickle", null)).Message); }
private void IsComplexType_throws_with_conflicting_configuration_assert( ConventionTypeConfiguration config, Action<ConventionTypeConfiguration> configAction, string methodName) { config.IsComplexType(); Assert.Equal( Strings.LightweightEntityConfiguration_ConfigurationConflict_ComplexType(methodName, config.ClrType.Name), Assert.Throws<InvalidOperationException>( () => configAction(config)).Message); Assert.Equal( Strings.LightweightEntityConfiguration_ConfigurationConflict_ComplexType(methodName, config.ClrType.Name), Assert.Throws<InvalidOperationException>( () => config.IsComplexType()).Message); }
public void ToTable_with_schema_is_noop_when_set() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); innerConfig.ToTable("Table1", "Schema1"); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.ToTable("Table2", "Schema2"); Assert.Equal("Table1", innerConfig.TableName); Assert.Equal("Schema1", innerConfig.SchemaName); }
public void HasAnnotation_configures_only_annotations_that_have_not_already_been_set() { var type = new MockType(); var innerConfig = new EntityTypeConfiguration(type); innerConfig.SetAnnotation("A1", "V1"); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); var result = config.HasTableAnnotation("A1", "V1B").HasTableAnnotation("A2", "V2"); Assert.Equal("V1", innerConfig.Annotations["A1"]); Assert.Equal("V2", innerConfig.Annotations["A2"]); Assert.Same(config, result); }