private void IsComplexType_throws_with_conflicting_configuration_assert( ConventionTypeConfiguration config, Action <ConventionTypeConfiguration> configAction) { config.IsComplexType(); Assert.Equal( Strings.LightweightEntityConfiguration_ConfigurationConflict_ComplexType, Assert.Throws <InvalidOperationException>( () => configAction(config)).Message); Assert.Equal( Strings.LightweightEntityConfiguration_ConfigurationConflict_ComplexType, Assert.Throws <InvalidOperationException>( () => config.IsComplexType()).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 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 Ignore_configures_complex_type_property() { var type = typeof(AType); var innerConfig = new ComplexTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.IsComplexType(); config.Ignore("Property1"); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1")); }
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()); }
/// <summary> /// Changes this entity type to a complex type. /// </summary> /// <returns> /// The same <see cref="ConventionTypeConfiguration{T}" /> instance so that multiple calls can be chained. /// </returns> public ConventionTypeConfiguration <T> IsComplexType() { _configuration.IsComplexType(); return(this); }
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()); }
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 Ignore_configures_complex_type_property() { var type = typeof(AType); var innerConfig = new ComplexTypeConfiguration(type); var config = new ConventionTypeConfiguration(type, () => innerConfig, new ModelConfiguration()); config.IsComplexType(); config.Ignore("Property1"); Assert.Equal(1, innerConfig.IgnoredProperties.Count()); Assert.True(innerConfig.IgnoredProperties.Any(p => p.Name == "Property1")); }