예제 #1
0
        public void writerWritesEndDocument()
        {
            XmlWriterCounter xmlWriter = new XmlWriterCounter();
            RdfXmlWriter     rdfWriter = new RdfXmlWriter(xmlWriter);

            writeSingleUUUTriple(rdfWriter);

            Assert.AreEqual(1, xmlWriter.WriteEndDocumentCalled);
        }
예제 #2
0
        public void writerWritesOneRdfDescriptionPerUniqueSubject()
        {
            XmlWriterCounter xmlWriter = new XmlWriterCounter();
            RdfXmlWriter     rdfWriter = new RdfXmlWriter(xmlWriter);

            rdfWriter.StartOutput();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteUriRef("http://example.com/obj");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj2");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteUriRef("http://example.com/obj");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.StartSubject();
            rdfWriter.WriteUriRef("http://example.com/subj");
            rdfWriter.StartPredicate();
            rdfWriter.WriteUriRef("http://example.com/pred");
            rdfWriter.StartObject();
            rdfWriter.WriteUriRef("http://example.com/obj2");
            rdfWriter.EndObject();
            rdfWriter.EndPredicate();
            rdfWriter.EndSubject();
            rdfWriter.EndOutput();

            // elements should be: rdf:RDF, rdf:Description * 2, ns1:pred * 3
            Assert.AreEqual(6, xmlWriter.WriteEndElementCalled);
        }