Exemplo n.º 1
0
        public void parserUsesResourceFactoryToCreateBlankObject()
        {
            StringReader reader = new StringReader("<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rdf:Description rdf:about=\"http://example.org/node\"><rdf:type><rdf:Description /></rdf:type></rdf:Description></rdf:RDF>");

            ResourceFactoryStore resourceFactory = new ResourceFactoryStore();
            DriveParser          parser          = new DriveParser(resourceFactory, new StatementFactoryStub());

            parser.Parse(reader, "");

            Assert.IsTrue(resourceFactory.WasMakeBlankNodeCalledWith("drive10000"));
        }
Exemplo n.º 2
0
        public void parserUsesSuppliedDereferencerToGetRepresentationsOfStringUris()
        {
            DriveParser parser = new DriveParser(new ResourceFactoryStub(), new StatementFactoryStub());

            DereferencerStore dereferencer = new DereferencerStore();

            parser.SetDereferencer(dereferencer);
            parser.Parse("http://example.com/", "");

            Assert.IsTrue(dereferencer.WasDereferenceCalledWith("http://example.com/"));
        }
Exemplo n.º 3
0
        public void parserUsesStatementFactoryToCreateBUTStatement()
        {
            StringReader reader = new StringReader("<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rdf:Description><rdf:type rdf:datatype=\"http://example.com/type\">foo</rdf:type></rdf:Description></rdf:RDF>");

            StatementFactoryCounter statementFactory = new StatementFactoryCounter();
            DriveParser             parser           = new DriveParser(new ResourceFactoryStub(), statementFactory);

            parser.Parse(reader, "");

            Assert.AreEqual(1, statementFactory.MakeStatementBUTCalled);
        }
Exemplo n.º 4
0
        public void parserUsesResourceFactoryToCreateTypedLiteralObject()
        {
            StringReader reader = new StringReader("<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rdf:Description rdf:about=\"http://example.org/node\"><rdf:type rdf:datatype=\"http://example.com/type\">foo</rdf:type></rdf:Description></rdf:RDF>");

            ResourceFactoryStore resourceFactory = new ResourceFactoryStore();
            DriveParser          parser          = new DriveParser(resourceFactory, new StatementFactoryStub());

            parser.Parse(reader, "");

            Assert.IsTrue(resourceFactory.WasMakeTypedLiteralCalledWith("foo", "http://example.com/type"));
        }
Exemplo n.º 5
0
        public void parserPassesResourceFactoryObjectsToStatementFactory()
        {
            StringReader reader = new StringReader("<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"><rdf:Description rdf:about=\"http://example.org/node\"><rdf:type rdf:resource=\"http://example.org/type\"/></rdf:Description></rdf:RDF>");

            StatementFactoryStore    statementFactory = new StatementFactoryStore();
            ResourceFactoryResponder resourceFactory  = new ResourceFactoryResponder();


            DriveParser parser = new DriveParser(resourceFactory, statementFactory);

            parser.Parse(reader, "");

            Assert.IsTrue(statementFactory.WasMakeStatementCalledWith(resourceFactory.itsUriRefResponse, resourceFactory.itsUriRefResponse, resourceFactory.itsUriRefResponse));
        }