public void Cloning_an_foreign_key_mapping_configuration_clones_its_annotation_information() { var configuration = new ForeignKeyAssociationMappingConfiguration(); configuration.MapKey("C1", "C2"); configuration.HasColumnAnnotation("C1", "A1", "V1"); configuration.HasColumnAnnotation("C2", "A2", "V2"); var clone = (ForeignKeyAssociationMappingConfiguration)configuration.Clone(); Assert.Equal(configuration, clone); configuration.HasColumnAnnotation("C2", "A2", "V3"); Assert.NotEqual(configuration, clone); }
public void HasKeyAnnotation_checks_arguments() { var configuration = new ForeignKeyAssociationMappingConfiguration(); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("keyColumnName"), Assert.Throws <ArgumentException>(() => configuration.HasColumnAnnotation(null, "A", "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("keyColumnName"), Assert.Throws <ArgumentException>(() => configuration.HasColumnAnnotation(" ", "A", "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("annotationName"), Assert.Throws <ArgumentException>(() => configuration.HasColumnAnnotation("K", null, "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("annotationName"), Assert.Throws <ArgumentException>(() => configuration.HasColumnAnnotation("K", " ", "V")).Message); }
public void HasKeyAnnotation_checks_arguments() { var configuration = new ForeignKeyAssociationMappingConfiguration(); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("keyColumnName"), Assert.Throws<ArgumentException>(() => configuration.HasColumnAnnotation(null, "A", "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("keyColumnName"), Assert.Throws<ArgumentException>(() => configuration.HasColumnAnnotation(" ", "A", "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("annotationName"), Assert.Throws<ArgumentException>(() => configuration.HasColumnAnnotation("K", null, "V")).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("annotationName"), Assert.Throws<ArgumentException>(() => configuration.HasColumnAnnotation("K", " ", "V")).Message); }