public void Clone_Full_ReturnsExpected() { var original = new SyndicationLink(new Uri("http://microsoft.com"), "relationshipType", "title", "mediaType", 10) { BaseUri = new Uri("http://baseuri.com") }; original.AttributeExtensions.Add(new XmlQualifiedName("name"), "value"); original.ElementExtensions.Add(new ExtensionObject { Value = 10 }); SyndicationLink clone = original.Clone(); Assert.NotSame(clone.AttributeExtensions, original.AttributeExtensions); Assert.Equal(1, clone.AttributeExtensions.Count); Assert.Equal("value", clone.AttributeExtensions[new XmlQualifiedName("name")]); Assert.Equal(new Uri("http://baseuri.com"), clone.BaseUri); Assert.NotSame(clone.ElementExtensions, original.ElementExtensions); Assert.Equal(1, clone.ElementExtensions.Count); Assert.Equal(10, clone.ElementExtensions[0].GetObject <ExtensionObject>().Value); Assert.Equal(10, clone.Length); Assert.Equal("mediaType", clone.MediaType); Assert.Equal("relationshipType", clone.RelationshipType); Assert.Equal("title", clone.Title); Assert.Equal(new Uri("http://microsoft.com"), clone.Uri); }
public void Clone() { SyndicationLink link = new SyndicationLink(null, null, "my RSS", "text/xml", 1); link.BaseUri = new Uri("http://mono-project.com/index.rss"); SyndicationLink clone = link.Clone(); Assert.AreEqual(link.BaseUri, clone.BaseUri, "#1"); Assert.AreEqual("my RSS", clone.Title, "#2"); Assert.AreEqual("text/xml", clone.MediaType, "#3"); Assert.IsNull(clone.RelationshipType, "#4"); Assert.IsNull(clone.Uri, "#5"); }
public void Clone_Empty_ReturnsExpected() { var original = new SyndicationLink(); SyndicationLink clone = original.Clone(); Assert.Empty(clone.AttributeExtensions); Assert.Null(clone.BaseUri); Assert.Empty(clone.ElementExtensions); Assert.Equal(0, clone.Length); Assert.Null(clone.MediaType); Assert.Null(clone.RelationshipType); Assert.Null(clone.Title); Assert.Null(clone.Uri); }