Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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"));
        }
Ejemplo n.º 4
0
        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."));
        }