public void Test_FromIXPathNavigable() { using (MagickImage image = new MagickImage(Files.InvitationTif)) { XmpProfile profile = image.GetXmpProfile(); Assert.IsNotNull(profile); IXPathNavigable doc = profile.ToIXPathNavigable(); ExceptionAssert.Throws <ArgumentNullException>(delegate() { XmpProfile.FromIXPathNavigable(null); }); XmpProfile newProfile = XmpProfile.FromIXPathNavigable(doc); image.AddProfile(newProfile); doc = profile.ToIXPathNavigable(); TestIXPathNavigable(doc); profile = image.GetXmpProfile(); Assert.IsNotNull(profile); doc = profile.ToIXPathNavigable(); TestIXPathNavigable(doc); Assert.AreEqual(profile, newProfile); } }
public void Test_FromIXPathNavigable() { using (var image = new MagickImage(Files.InvitationTIF)) { var profile = image.GetXmpProfile(); Assert.NotNull(profile); var doc = profile.ToIXPathNavigable(); Assert.Throws <ArgumentNullException>("document", () => { XmpProfile.FromIXPathNavigable(null); }); var newProfile = XmpProfile.FromIXPathNavigable(doc); image.SetProfile(newProfile); doc = profile.ToIXPathNavigable(); TestIXPathNavigable(doc); profile = image.GetXmpProfile(); Assert.NotNull(profile); doc = profile.ToIXPathNavigable(); TestIXPathNavigable(doc); Assert.Equal(profile, newProfile); } }
public void ShouldThrowExceptionWhenDocumentIsNull() { Assert.Throws <ArgumentNullException>("document", () => { XmpProfile.FromIXPathNavigable(null); }); }
public void ShouldCreateProfileFromIXPathNavigable() { var document = new XmlDocument(); document.LoadXml("<test />"); var profile = XmpProfile.FromIXPathNavigable(document); Assert.NotNull(profile); Assert.Equal(@"<?xml version=""1.0"" encoding=""utf-8""?><test />", Encoding.UTF8.GetString(profile.ToByteArray())); }