public void Add_duplicate_annotation_replaces_current_annotation() { var metadataBase = new ConcreteMetadata(); metadataBase.Annotations.Add(new Annotation("Foo", "Bar")); var newAnnotation = new Annotation("Foo", "Bar"); metadataBase.Annotations.Add(newAnnotation); Assert.Same(newAnnotation, metadataBase.Annotations.Single()); }
public void Can_remove_annotation() { var metadataBase = new ConcreteMetadata(); var annotation = new Annotation("Foo", "Bar"); metadataBase.Annotations.Add(annotation); Assert.Equal("Bar", metadataBase["Foo"]); metadataBase.Annotations.Remove(annotation); Assert.Null(metadataBase["Foo"]); metadataBase.Annotations.Remove(annotation); // no throw }
public void Can_update_existing_annotation() { var metadataBase = new ConcreteMetadata(); var annotation = new Annotation("Foo", "Bar"); metadataBase.Annotations.Add(annotation); Assert.Equal("Bar", metadataBase["Foo"]); metadataBase["Foo"] = "Baz"; Assert.Equal("Baz", metadataBase["Foo"]); }
public void Annotations_are_ordered_by_name() { var metadataBase = new ConcreteMetadata(); var annotation1 = new Annotation("Z", "Foo"); var annotation2 = new Annotation("A", "Bar"); metadataBase.Annotations.Add(annotation1); metadataBase.Annotations.Add(annotation2); Assert.True(new[] { annotation2, annotation1 }.SequenceEqual(metadataBase.Annotations)); }