コード例 #1
0
        public void ToCanonicalStringFragment_IgnoresIrrelevantSpace()
        {
            const string xml1 = "<element attr1=\"1\" attr2=\"2\" />";
            const string xml2 = "<element attr1=\"1\"  attr2=\"2\"  />";

            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
        }
コード例 #2
0
        public void ToCanonicalStringFragment_FragmentsAreEquivalent()
        {
            const string xml1 = "<element1 /><element2 />";
            const string xml2 = "<element1/><element2/>";

            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
        }
コード例 #3
0
        public void ToCanonicalStringFragment_DoesNotIgnoreElementOrder()
        {
            const string xml1 = "<root><element1 /><element2 /></root>";
            const string xml2 = "<root><element2 /><element1 /></root>";

            Assert.AreNotEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
        }
コード例 #4
0
        public void ToCanonicalStringFragment_IgnoresIrrelevantIndentation()
        {
            const string xml1 = "<root>\n  <element1 />\n  <element2 />\n</root>";
            const string xml2 = "<root>\n\t<element1 />\n\t<element2 />\n</root>";

            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
        }
コード例 #5
0
        public void ToCanonicalStringFragment_IgnoresIrrelevantLineBreakWithinElement()
        {
            const string xml1 = "<element attr1=\"1\"\r\nattr2=\"2\" />";
            const string xml2 = "<element attr1=\"1\"\nattr2=\"2\" />";
            const string xml3 = "<element attr1=\"1\" attr2=\"2\" />";

            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml3));
            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml2), CanonicalXml.ToCanonicalStringFragment(xml3));
        }
コード例 #6
0
        public void ToCanonicalStringFragment_IgnoresIrrelevantLineBreak()
        {
            const string xml1 = "<root><element1 />\r\n<element2 /></root>";
            const string xml2 = "<root><element1 />\r<element2 /></root>";
            const string xml3 = "<root><element1 />\n<element2 /></root>";

            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml2));
            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml1), CanonicalXml.ToCanonicalStringFragment(xml3));
            Assert.AreEqual(CanonicalXml.ToCanonicalStringFragment(xml2), CanonicalXml.ToCanonicalStringFragment(xml3));
        }