Skip to content

Commit

Permalink
Better way of testing query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Jan 3, 2024
1 parent 86e3057 commit db82abf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions RDFSharp.Test/Query/Mirella/RDFQueryEngineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1548,10 +1548,11 @@ public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpoints()
Assert.IsTrue(string.Equals(result.Rows[2]["?Y"].ToString(), "ex:balto"));
Assert.IsTrue(string.Equals(result.Rows[2]["?X"].ToString(), "ex:whoever"));

string qString = query.ToString();
Assert.IsNotNull(receivedQuery1);
Assert.IsTrue(string.Equals(receivedQuery1, $"?query=SELECT+*%0aWHERE+%7b%0a++%7b%0a++++%3fY+%3cex%3adogOf%3e+%3fX+.%0a++%7d%0a%7d%0a"));
Assert.IsTrue(string.Equals(receivedQuery1, $"?query={HttpUtility.UrlEncode(qString)}"));
Assert.IsNotNull(receivedQuery2);
Assert.IsTrue(string.Equals(receivedQuery2, $"query=SELECT+*%0aWHERE+%7b%0a++%7b%0a++++%3fY+%3cex%3adogOf%3e+%3fX+.%0a++%7d%0a%7d%0a"));
Assert.IsTrue(string.Equals(receivedQuery2, $"query={HttpUtility.UrlEncode(qString)}"));
}

[TestMethod]
Expand Down Expand Up @@ -1673,10 +1674,11 @@ public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpointsOneG
Assert.IsTrue(string.Equals(result.Rows[1]["?Y"].ToString(), "ex:fido"));
Assert.IsTrue(string.Equals(result.Rows[1]["?X"].ToString(), "ex:paperino"));

string qString = query.ToString();
Assert.IsNotNull(receivedQuery1);
Assert.IsTrue(string.Equals(receivedQuery1, $"?query=SELECT+*%0aWHERE+%7b%0a++%7b%0a++++%3fY+%3cex%3adogOf%3e+%3fX+.%0a++%7d%0a%7d%0a"));
Assert.IsTrue(string.Equals(receivedQuery1, $"?query={HttpUtility.UrlEncode(qString)}"));
Assert.IsNotNull(receivedQuery2);
Assert.IsTrue(string.Equals(receivedQuery2, string.Empty)); //empty because timeout (250ms) occurred before execution of valorization payload (750 ms)
Assert.IsTrue(string.Equals(receivedQuery2, string.Empty));
}

[TestMethod]
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp/Query/Mirella/RDFQueryEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ internal DataTable ApplyPatternToFederation(RDFPattern pattern, RDFFederation fe
}

/// <summary>
/// Applies the given pattern to the given federation
/// Applies the given pattern to the given SPARQL endpoint (within a federation)
/// </summary>
internal DataTable ApplyPatternToSPARQLEndpoint(RDFPattern pattern, RDFSPARQLEndpoint sparqlEndpoint, RDFSPARQLEndpointQueryOptions sparqlEndpointQueryOptions=null)
{
Expand Down

0 comments on commit db82abf

Please sign in to comment.