public void VerifyMultipleBUUMatchWithTwoNodeIdsReceiveUsesDifferentIdsOutOfOrder() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("_:genid2 <http://example/pred> <http://example.com/obj> ."); verifier.Expect("_:genid1 <http://example/pred2> <http://example.com/obj> ."); verifier.Receive("_:buffy1 <http://example/pred2> <http://example.com/obj> ."); verifier.Receive("_:buffy2 <http://example/pred> <http://example.com/obj> ."); Assert.IsTrue(verifier.Verify()); }
public void VerifyMultipleBUBMatchWithDifferentNodeId() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("_:genid1 <http://example/pred> _:genid1 ."); verifier.Expect("_:genid1 <http://example/pred2> _:genid1 ."); verifier.Receive("_:buffy <http://example/pred> _:buffy ."); verifier.Receive("_:buffy <http://example/pred2> _:buffy ."); Assert.IsTrue(verifier.Verify()); }
public void VerifyMultipleUUBMatchWithTwoNodeIdsReceiveUsesDifferentIdsOutOfOrder() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> _:genid1 ."); verifier.Expect("<http://example/subj> <http://example/pred2> _:genid2 ."); verifier.Receive("<http://example/subj> <http://example/pred2> _:buffy2 ."); verifier.Receive("<http://example/subj> <http://example/pred> _:buffy1 ."); Assert.IsTrue(verifier.Verify()); }
public void VerifyMultipleBUUMatchWithSameNodeId() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("_:genid1 <http://example/pred> <http://example/obj> ."); verifier.Expect("_:genid1 <http://example/pred2> <http://example/obj> ."); verifier.Receive("_:genid1 <http://example/pred> <http://example/obj> ."); verifier.Receive("_:genid1 <http://example/pred2> <http://example/obj> ."); Assert.IsTrue(verifier.Verify()); }
public void VerifyRecievedCountMustNotBeLessThanExpected() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"@en ."); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"@fr ."); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"@en ."); Assert.IsFalse(verifier.Verify()); }
public void VerifyNonBlankNodeTriplesComparedInAnyOrder() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"@en ."); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Expect("<http://example/subj> <http://example/pred> <http://example/obj> ."); verifier.Receive("<http://example/subj> <http://example/pred> <http://example/obj> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"@en ."); Assert.IsTrue(verifier.Verify()); }
public bool verify(TripleStore store) { NTripleListVerifier verifier = new NTripleListVerifier(); foreach (string nTriple in itsTriples) { verifier.Expect(nTriple); } StringWriter received = new StringWriter(); NTripleWriter writer = new NTripleWriter(received); store.Write(writer); StringReader receivedReader = new StringReader(received.ToString()); string receivedLine = receivedReader.ReadLine(); while (receivedLine != null) { string trimmed = receivedLine.Trim(); if (trimmed.Length > 0 && !trimmed.StartsWith("#")) { verifier.Receive(trimmed); } receivedLine = receivedReader.ReadLine(); } bool verifyResult = verifier.Verify(); lastFailureDescription = verifier.GetLastFailureDescription(); return(verifyResult); }
public void VerifySingleUUPMismatchWithLanguageByLexicalValue() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"@en ."); verifier.Receive("<http://example/subj> <http://example/pred> \"bang\"@en ."); Assert.IsFalse(verifier.Verify()); }
public void VerifySingleUUPMatch() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\" ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\" ."); Assert.IsTrue(verifier.Verify()); }
public void VerifySingleUUUMismatch() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> <http://example/obj> ."); verifier.Receive("<http://example/subj> <http://example/pred> <http://example/obj2> ."); Assert.IsFalse(verifier.Verify()); }
public void VerifierNormalisesWhitespaceBetweenExpectedTripleComponents() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> <http://example/obj> ."); verifier.Receive("<http://example/subj> <http://example/pred> <http://example/obj> ."); Assert.IsTrue(verifier.Verify()); }
public void VerifySingleBUUMatchWithDifferentNodeId() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("_:genid1 <http://example/pred> <http://example/obj> ."); verifier.Receive("_:jimbob <http://example/pred> <http://example/obj> ."); Assert.IsTrue(verifier.Verify()); }
public void VerifySingleUUBMatchWithDifferentNodeId() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> _:genid1 ."); verifier.Receive("<http://example/subj> <http://example/pred> _:gook ."); Assert.IsTrue(verifier.Verify()); }
public void VerifySingleUUTMismatchByDatatype() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/foo> ."); Assert.IsFalse(verifier.Verify()); }
public void VerifyConsidersDuplicateReceivedTriples() { NTripleListVerifier verifier = new NTripleListVerifier(); verifier.Expect("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); verifier.Receive("<http://example/subj> <http://example/pred> \"fizz\"^^<http://example.com/type> ."); Assert.IsFalse(verifier.Verify()); }
public bool Run() { string failureDescription = ""; NTripleListVerifier verifier = new NTripleListVerifier(); FileStream expectedStream = new FileStream(itsOutputFileName, FileMode.Open, FileAccess.Read, FileShare.Read); StreamReader expectedStreamReader = new StreamReader(expectedStream); string expectedLine = expectedStreamReader.ReadLine(); while (expectedLine != null) { string trimmed = expectedLine.Trim(); if (trimmed.Length > 0 && !trimmed.StartsWith("#")) { verifier.Expect(trimmed); } expectedLine = expectedStreamReader.ReadLine(); } FileStream inputStream = new FileStream(itsInputFileName, FileMode.Open, FileAccess.Read, FileShare.Read); bool testPassed = false; try { SimpleModel model = new SimpleModel(itsParserFactory); model.Parse(inputStream, itsBaseUri); foreach (string ntriple in model) { verifier.Receive(ntriple); } testPassed = verifier.Verify(); failureDescription = verifier.GetLastFailureDescription() + "\r\nTriples received:\r\n" + model.ToString(); } catch (Exception e) { failureDescription = "Parse exception: " + e; } if (!testPassed) { itsFailureDescription = "FAILED " + itsBaseUri + "\r\nReason: " + failureDescription + "\r\n"; } return(testPassed); }