Beispiel #1
0
        public void XmlCompareConstrainsXDocumentEqual()
        {
            var expected = XDocument.Parse(XmlSamples.GetContent("elements"));
            var actual   = XDocument.Parse(XmlSamples.GetContent("elements-with-comment"));

            Assert.That(expected, IsXml.Equals(actual).WithIgnoreComment());
        }
Beispiel #2
0
        public void XmlCompareConstrainUseNUnitFormatter()
        {
            var actual   = XmlSamples.GetContent("elements");
            var expected = XmlSamples.GetContent("elements-with-comment");

            Assert.That(expected, IsXml.Different(actual).WithIgnoreComment(false));
        }
Beispiel #3
0
        public void XmlCompareConstrainsSimpleSimilarTest()
        {
            var expected = XmlSamples.GetContent("elements");
            var actual   = XmlSamples.GetContent("elements-with-different-order");

            Assert.That(expected, IsXml.Similar(actual));
        }
Beispiel #4
0
        public void XmlCompareConstraintSimpleEqualsTest()
        {
            var expected = XmlSamples.GetContent("attr");
            var actual   = XmlSamples.GetContent("attr-with-another-order");

            Assert.That(expected, IsXml.Equals(actual));
        }
Beispiel #5
0
        public void CompareNamespacesWithDifferentPrefixesIsSimilarTest()
        {
            var actual   = XmlSamples.GetContent("ns");
            var expected = XmlSamples.GetContent("ns-with-another-prefix");

            Assert.That(expected, IsXml.Similar(actual));
        }
Beispiel #6
0
        private static XmlComparisonResult CompareItems(XmlComparer comparer, string expectedItem, string actualItem)
        {
            var expectedXml = XmlSamples.GetContent(expectedItem);
            var actualXml   = XmlSamples.GetContent(actualItem);

            return(comparer.Compare(expectedXml, actualXml));
        }
        public void XmlValidationConstraintSchemaWithNamespaceTest()
        {
            var    document = XmlSamples.GetContent("ns");
            var    emptyNamespaceSchemaPath = XmlSamples.GetFullPathByName(@"Xsd/ns.xsd");
            var    namespaceSchemaPath      = XmlSamples.GetFullPathByName(@"Xsd/ns_app1.xsd");
            string nameSpace = @"http://example.org";

            Assert.That(document, IsXml.Valid().WithSchema(emptyNamespaceSchemaPath).WithSchema(nameSpace, namespaceSchemaPath));
        }
        public void XmlValidationConstraintTextReaderSchema()
        {
            var document            = XmlSamples.GetContent("ns-without-namespace");
            var namespaceSchemaPath = XmlSamples.GetFullPathByName(@"Xsd/ns-without-namespace.xsd");

            Assert.That(
                document,
                IsXml.Valid().WithSchema(namespaceSchemaPath));
        }
Beispiel #9
0
        public void XmlCompareConstrainsEqualsWithDifferentOrder()
        {
            var expected = XmlSamples.GetContent("elements");
            var actual   = XmlSamples.GetContent("elements-with-different-order");

            Assert.That(
                expected,
                IsXml.Equals(actual).UseAnalizer(XmlAnalyzer.Custom().SetEqual(XmlComparisonType.NodeListSequence)));
        }
Beispiel #10
0
        public void XmlCompareConstrainWithXsdReference()
        {
            var actual   = XmlSamples.GetContent("with-xsd-reference");
            var expected = XmlSamples.GetContent("with-xsd-another-reference");

            Assert.That(
                expected,
                IsXml.Equals(actual)
                .UseAnalizer(XmlAnalyzer.Custom().SetEqual(XmlComparisonType.SchemaLocation)));
        }
Beispiel #11
0
        public void XmlCompareConstrainCustomAnalyzerIgnoreNodeMissing()
        {
            var expected = XmlSamples.GetContent("elements");
            var actual   = XmlSamples.GetContent("elements-with-comment");

            Assert.That(
                expected,
                IsXml.Equals(actual)
                .WithIgnoreComment(false)
                .UseAnalizer(XmlAnalyzer.Custom()
                             .SetEqual(XmlComparisonType.NodeList)
                             .SetEqual(XmlComparisonType.NodeListLookup)));
        }
        public void XmlValidationSimpleTest()
        {
            var document = XmlSamples.GetContent("ns");

            Assert.That(document, IsXml.Valid());
        }
        public void XmlValidationConstraintWithDocumentsSchema()
        {
            var document = XmlSamples.GetContent("with-xsd-reference");

            Assert.That(document, IsXml.Valid().WithDocumentSchemas());
        }