Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Nov 1, 2023
1 parent 3db4253 commit 39e06fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
25 changes: 25 additions & 0 deletions RDFSharp.Test/Model/RDFGraphTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,31 @@ public void ShouldAddTripleAsImport()
Assert.IsTrue(graph.Count(t => t.TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsImport) == 1);
}

[TestMethod]
public void ShouldAddTriplesMixingMetadata()
{
RDFGraph graph = new RDFGraph();
RDFTriple triple1 = new RDFTriple(new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFPlainLiteral("lit","en-US"));
RDFTriple triple2 = new RDFTriple(new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFResource("http://obj/"))
.SetMetadata(RDFModelEnums.RDFTripleMetadata.IsInference);
RDFTriple triple3 = new RDFTriple(new RDFResource("http://subj/"), new RDFResource("http://pred/"), new RDFPlainLiteral("lit"))
.SetMetadata(RDFModelEnums.RDFTripleMetadata.IsImport);
graph.AddTriple(triple1);
graph.AddTriple(triple2);
graph.AddTriple(triple3);

Assert.IsTrue(graph.TriplesCount == 3);
Assert.IsTrue(graph.IndexedTriples.ContainsKey(triple1.TripleID));
Assert.IsTrue(graph.IndexedTriples[triple1.TripleID].TripleMetadata is null);
Assert.IsTrue(graph.IndexedTriples.ContainsKey(triple2.TripleID));
Assert.IsTrue(graph.IndexedTriples[triple2.TripleID].TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsInference);
Assert.IsTrue(graph.IndexedTriples.ContainsKey(triple3.TripleID));
Assert.IsTrue(graph.IndexedTriples[triple3.TripleID].TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsImport);
Assert.IsTrue(graph.Count(t => t.TripleMetadata is null) == 1);
Assert.IsTrue(graph.Count(t => t.TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsInference) == 1);
Assert.IsTrue(graph.Count(t => t.TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsImport) == 1);
}

[TestMethod]
public void ShouldNotAddDuplicateTriples()
{
Expand Down
4 changes: 4 additions & 0 deletions RDFSharp.Test/Model/RDFTripleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ public void ShouldCreateSPOTriple(string s, string p, string o)
Assert.IsNull(triple.TripleMetadata);
triple.SetMetadata(RDFModelEnums.RDFTripleMetadata.IsInference);
Assert.IsTrue(triple.TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsInference);
triple.SetMetadata(RDFModelEnums.RDFTripleMetadata.IsImport);
Assert.IsTrue(triple.TripleMetadata == RDFModelEnums.RDFTripleMetadata.IsImport);
triple.SetMetadata(null);
Assert.IsTrue(triple.TripleMetadata is null);
}

[DataTestMethod]
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp.Test/RDFSharp.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AssemblyTitle>RDFSharp.Test</AssemblyTitle>
<AssemblyName>RDFSharp.Test</AssemblyName>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Version>3.8.1</Version>
<Version>3.9.0</Version>
<Authors>Marco De Salvo</Authors>
<Copyright>Marco De Salvo</Copyright>
<TargetFramework>net6.0</TargetFramework>
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp/RDFSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<AssemblyTitle>RDFSharp</AssemblyTitle>
<AssemblyName>RDFSharp</AssemblyName>
<AssemblyVersion>$(Version)</AssemblyVersion>
<Version>3.8.1</Version>
<Version>3.9.0</Version>
<Authors>Marco De Salvo</Authors>
<Copyright>Marco De Salvo</Copyright>
<Description>Lightweight and friendly .NET library for realizing Semantic Web applications</Description>
Expand Down

0 comments on commit 39e06fb

Please sign in to comment.