public virtual void XxeTestFromByteBuffer() { String metadataToParse = MessageFormatUtil.Format(XMP_WITH_XXE, XXE_FILE_PATH); XMPMeta xmpMeta = XMPMetaParser.Parse(metadataToParse.GetBytes(System.Text.Encoding.UTF8), null); NUnit.Framework.Assert.AreEqual(EXPECTED_SERIALIZED_XMP, XMPMetaFactory.SerializeToString(xmpMeta, null)); }
public virtual void XxeTestFromString() { String metadataToParse = MessageFormatUtil.Format(XMP_WITH_XXE, XXE_FILE_PATH); XMPMeta xmpMeta = XMPMetaParser.Parse(metadataToParse, null); NUnit.Framework.Assert.AreEqual(EXPECTED_SERIALIZED_XMP, XMPMetaFactory.SerializeToString(xmpMeta, null)); }
public virtual void XxeTestFromByteBuffer() { String metadataToParse = MessageFormatUtil.Format(XMP_WITH_XXE, XXE_FILE_PATH); NUnit.Framework.Assert.That(() => { // the line below is expected to produce an exception XMPMetaParser.Parse(metadataToParse.GetBytes(System.Text.Encoding.UTF8), null); } , NUnit.Framework.Throws.InstanceOf <XMPException>().With.Message.EqualTo("Unsupported Encoding")); }
public virtual void XxeTestFromString() { String metadataToParse = MessageFormatUtil.Format(XMP_WITH_XXE, XXE_FILE_PATH); NUnit.Framework.Assert.That(() => { // the line below is expected to produce an exception XMPMetaParser.Parse(metadataToParse, null); } , NUnit.Framework.Throws.InstanceOf <XmlException>().With.Message.EqualTo("Reference to undeclared entity 'xxe'. Line 6, position 27.")); }