public void Can_create_hierarchy_mappings() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping(new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); Assert.False(entityTypeMapping.IsHierarchyMapping); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); Assert.True(entityTypeMapping.IsHierarchyMapping); entityTypeMapping.RemoveIsOfType(entityType); entityTypeMapping.AddType(entityType); Assert.False(entityTypeMapping.IsHierarchyMapping); var entityType2 = new EntityType("E2", "N", DataSpace.CSpace); entityTypeMapping.AddType(entityType2); Assert.True(entityTypeMapping.IsHierarchyMapping); }
public void Cannot_remove_isOfType_when_read_only() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping( new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); entityTypeMapping.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyItem, Assert.Throws <InvalidOperationException>( () => entityTypeMapping.RemoveIsOfType(entityType)).Message); }
public void Can_add_remove_isOfType() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping( new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); Assert.Empty(entityTypeMapping.IsOfTypes); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); Assert.Same(entityType, entityTypeMapping.IsOfTypes.Single()); entityTypeMapping.RemoveIsOfType(entityType); Assert.Empty(entityTypeMapping.IsOfTypes); }
public void Can_create_hierarchy_mappings() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping(new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); Assert.False(entityTypeMapping.IsHierarchyMapping); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); Assert.True(entityTypeMapping.IsHierarchyMapping); entityTypeMapping.RemoveIsOfType(entityType); entityTypeMapping.AddType(entityType); Assert.False(entityTypeMapping.IsHierarchyMapping); var entityType2 = new EntityType("E2", "N", DataSpace.CSpace); entityTypeMapping.AddType(entityType2); Assert.True(entityTypeMapping.IsHierarchyMapping); }
public void Cannot_remove_isOfType_when_read_only() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping( new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); entityTypeMapping.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyItem, Assert.Throws<InvalidOperationException>( () => entityTypeMapping.RemoveIsOfType(entityType)).Message); }
public void Can_add_remove_isOfType() { var entityTypeMapping = new EntityTypeMapping( new EntitySetMapping( new EntitySet(), new EntityContainerMapping(new EntityContainer("C", DataSpace.CSpace)))); Assert.Empty(entityTypeMapping.IsOfTypes); var entityType = new EntityType("E", "N", DataSpace.CSpace); entityTypeMapping.AddIsOfType(entityType); Assert.Same(entityType, entityTypeMapping.IsOfTypes.Single()); entityTypeMapping.RemoveIsOfType(entityType); Assert.Empty(entityTypeMapping.IsOfTypes); }