public void ComplexTypeConvention_RemovesAnyKeyFromEntityConfiguration() { // Arrange EntityTypeConfiguration entity = CreateEntitytypeConfigurationMock(); entity.HasKey(new MockPropertyInfo(typeof(int), "Id")); ComplexTypeAttributeConvention convention = new ComplexTypeAttributeConvention(); // Act convention.Apply(entity, null, null); // Assert Assert.Equal(0, entity.Keys.Count()); }
public void ComplexTypeConvention_RemovesAnyKeyFromEntityConfiguration() { // Arrange EntityTypeConfiguration entity = CreateEntitytypeConfigurationMock(); entity.HasKey(new MockPropertyInfo(typeof(int), "Id")); ComplexTypeAttributeConvention convention = new ComplexTypeAttributeConvention(); // Act convention.Apply(entity, null, null); // Assert Assert.Empty(entity.Keys); }
public void ComplexTypeConvention_DoesntApplyToExplicitlyDefinedTypes() { // Arrange EntityTypeConfiguration entity = CreateEntitytypeConfigurationMock(); entity.AddedExplicitly = true; entity.HasKey(new MockPropertyInfo(typeof(int), "Id")); ComplexTypeAttributeConvention convention = new ComplexTypeAttributeConvention(); // Act convention.Apply(entity, null, null); // Assert Assert.Equal(1, entity.Keys.Count()); }
public void ComplexTypeConvention_DoesntApplyToExplicitlyDefinedTypes() { // Arrange EntityTypeConfiguration entity = CreateEntitytypeConfigurationMock(); entity.AddedExplicitly = true; entity.HasKey(new MockPropertyInfo(typeof(int), "Id")); ComplexTypeAttributeConvention convention = new ComplexTypeAttributeConvention(); // Act convention.Apply(entity, null, null); // Assert Assert.Single(entity.Keys); }