public void Multiple_matches_throws() { var entityType = CreateModel().AddEntityType(typeof(AlwaysLookOnTheBrightSideOfLife)); var property = entityType.AddProperty("OnTheRun", typeof(int)); var convention = new BackingFieldConvention(new TestLogger <DbLoggerCategory.Model, TestLoggingDefinitions>()); Assert.Equal( CoreStrings.ConflictingBackingFields( "OnTheRun", nameof(AlwaysLookOnTheBrightSideOfLife), "_onTheRun", "m_onTheRun"), Assert.Throws <InvalidOperationException>( () => convention.Apply(((Property)property).Builder)).Message); }
public void Object_property_non_object_field_matches_and_throws_ambiguous() { var entityType = CreateModel().AddEntityType(typeof(HesAVeryNaughtyBoy)); var property = entityType.AddProperty("OnTheRun", typeof(object)); var convention = new BackingFieldConvention(new TestLogger <DbLoggerCategory.Model, TestLoggingDefinitions>()); Assert.Equal( CoreStrings.ConflictingBackingFields( "OnTheRun", nameof(HesAVeryNaughtyBoy), "_onTheRun", "m_onTheRun"), Assert.Throws <InvalidOperationException>( () => convention.Apply(((Property)property).Builder)).Message); }
public void Object_field_non_object_property_matches_and_throws_ambiguous() { var entityType = new Model().AddEntityType(typeof(HesNotTheMessiah)); var property = entityType.AddProperty("OnTheRun", typeof(int)); var convention = new BackingFieldConvention(new TestLogger <DbLoggerCategory.Model>()); Assert.Equal( CoreStrings.ConflictingBackingFields( "OnTheRun", nameof(HesNotTheMessiah), "_onTheRun", "m_onTheRun"), Assert.Throws <InvalidOperationException>( () => convention.Apply(property.Builder)).Message); }