public void Apply_should_inline_type() { var mockType = new MockType(); var modelConfiguration = new ModelConfiguration(); new ComplexTypeAttributeConvention() .Apply(mockType, modelConfiguration, new ComplexTypeAttribute()); Assert.True(modelConfiguration.IsComplexType(mockType)); }
public void MapComplexType_should_recognize_StoreInline() { var type = typeof(TypeMapper_EntityWithStoreInline); var model = new EdmModel(DataSpace.CSpace); var modelConfiguration = new ModelConfiguration(); var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model)); typeMapper.MapComplexType(type); Assert.True(modelConfiguration.IsComplexType(type)); Assert.Equal(0, model.EntityTypes.Count()); Assert.Equal(1, model.ComplexTypes.Count()); }
public void MapEntityType_should_recognize_StoreInline() { var type = typeof(TypeMapper_EntityWithStoreInline); var model = new EdmModel().Initialize(); var modelConfiguration = new ModelConfiguration(); var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model)); typeMapper.MapEntityType(type); Assert.True(modelConfiguration.IsComplexType(type)); Assert.Equal(0, model.Namespaces.Single().EntityTypes.Count); Assert.Equal(0, model.Namespaces.Single().ComplexTypes.Count); }
public void MapEntityType_recognizes_TableName() { var type = typeof(TypeMapper_EntityWithTableName); var model = new EdmModel(DataSpace.CSpace); var modelConfiguration = new ModelConfiguration(); var typeMapper = new TypeMapper(new MappingContext(modelConfiguration, new ConventionsConfiguration(), model)); typeMapper.MapEntityType(type); Assert.False(modelConfiguration.IsComplexType(type)); Assert.Equal(1, model.EntityTypes.Count()); Assert.Equal(0, model.ComplexTypes.Count()); Assert.Equal("Foo", modelConfiguration.Entity(typeof(TypeMapper_EntityWithTableName)).GetTableName().Name); }
public void IsComplexType_should_return_true_when_type_is_complex() { var modelConfiguration = new ModelConfiguration(); modelConfiguration.Add(new Mock<ComplexTypeConfiguration>(typeof(object)).Object); Assert.True(modelConfiguration.IsComplexType(typeof(object))); }