public void Can_remove_annotation_by_setting_null() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); entityType.AddAnnotation("name", null); Assert.Empty(entityType.Annotations); }
public void Can_remove_annotation_by_setting_null() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); entityType.AddAnnotation("name", null); Assert.Empty(entityType.Annotations); }
public void AddAnnotation_checks_arguments() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws<ArgumentException>(() => entityType.AddAnnotation(null, null)).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws<ArgumentException>(() => entityType.AddAnnotation("", null)).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws<ArgumentException>(() => entityType.AddAnnotation(" ", null)).Message); }
public void AddAnnotation_checks_arguments() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws <ArgumentException>(() => entityType.AddAnnotation(null, null)).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws <ArgumentException>(() => entityType.AddAnnotation("", null)).Message); Assert.Equal( Strings.ArgumentIsNullOrWhitespace("name"), Assert.Throws <ArgumentException>(() => entityType.AddAnnotation(" ", null)).Message); }
public void Passing_a_null_value_causes_annotation_to_not_be_set() { var entityType = new EntityType("E", "N", DataSpace.CSpace); entityType.AddAnnotation("name", null); Assert.Empty(entityType.Annotations); }
public void Passing_a_null_value_causes_annotation_to_not_be_set() { var entityType = new EntityType("E", "N", DataSpace.CSpace); entityType.AddAnnotation("name", null); Assert.Empty(entityType.Annotations); }
public void RemoveAnnotation_returns_false_if_annotation_not_found() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.False(entityType.RemoveAnnotation("notfound")); }
public void AddAnnotation_throws_if_metadata_item_is_readonly() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyCollection, Assert.Throws <InvalidOperationException>(() => entityType.AddAnnotation("name", value)) .Message); }
public void Can_remove_annotation() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); Assert.True(entityType.RemoveAnnotation("name")); Assert.Empty(entityType.Annotations); }
public void Can_remove_annotation() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); Assert.True(entityType.RemoveAnnotation("name")); Assert.Empty(entityType.Annotations); }
public void Setting_annotation_value_throws_if_metadata_item_is_readonly() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value1 = new object(); var value2 = new object(); entityType.AddAnnotation("name", value1); entityType.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyItem, Assert.Throws <InvalidOperationException>(() => entityType.Annotations.Single().Value = value2) .Message); }
public void Setting_annotation_value_throws_if_metadata_item_is_readonly() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value1 = new object(); var value2 = new object(); entityType.AddAnnotation("name", value1); entityType.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyItem, Assert.Throws<InvalidOperationException>(() => entityType.Annotations.Single().Value = value2) .Message); }
public void Can_add_and_get_annotation() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); Assert.Empty(entityType.Annotations); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); Assert.Equal(1, entityType.Annotations.Count()); var annotation = entityType.Annotations.Single(); Assert.Equal("name", annotation.Name); Assert.Same(value, annotation.Value); }
public void Can_add_and_get_annotation() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); Assert.Empty(entityType.Annotations); entityType.AddAnnotation("name", value); Assert.NotEmpty(entityType.Annotations); Assert.Equal(1, entityType.Annotations.Count); var annotation = entityType.Annotations.Single(); Assert.Equal("name", annotation.Name); Assert.Same(value, annotation.Value); }
public void RemoveAnnotation_returns_false_if_annotation_not_found() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.AddAnnotation("name", value); Assert.False(entityType.RemoveAnnotation("notfound")); }
public void GetAnnotations_returns_only_annotations_with_annotation_prefix_and_strips_prefix() { var entityType = new EntityType("E", "N", DataSpace.CSpace); Assert.Empty(EdmModelDiffer.GetAnnotations(entityType)); entityType.AddAnnotation("name", new object()); Assert.Empty(EdmModelDiffer.GetAnnotations(entityType)); entityType.AddAnnotation(XmlConstants.CustomAnnotationPrefix + "First", "Amy"); entityType.AddAnnotation(XmlConstants.CustomAnnotationPrefix + "Last", "Winehouse"); Assert.Equal(2, EdmModelDiffer.GetAnnotations(entityType).Count); Assert.Same("Amy", EdmModelDiffer.GetAnnotations(entityType)["First"]); Assert.Same("Winehouse", EdmModelDiffer.GetAnnotations(entityType)["Last"]); entityType.AddAnnotation(XmlConstants.IndexAnnotationWithPrefix, new IndexAnnotation(new IndexAttribute())); Assert.Equal(2, EdmModelDiffer.GetAnnotations(entityType).Count); }
public void AddAnnotation_throws_if_metadata_item_is_readonly() { var entityType = new EntityType("E", "N", DataSpace.CSpace); var value = new object(); entityType.SetReadOnly(); Assert.Equal( Strings.OperationOnReadOnlyCollection, Assert.Throws<InvalidOperationException>(() => entityType.AddAnnotation("name", value)) .Message); }