Skip to content

Commit

Permalink
Applied quality suggestions from Rider
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Feb 9, 2025
1 parent 14206d4 commit c246224
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 55 deletions.
7 changes: 3 additions & 4 deletions RDFSharp.Test/Model/RDFCollectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
using RDFSharp.Model;
using RDFSharp.Query;
using System.Collections.Generic;
using System.Linq;

namespace RDFSharp.Test.Model;

Expand All @@ -39,8 +40,7 @@ public void ShouldCreateEmptyCollection(RDFModelEnums.RDFItemTypes itemType)
Assert.IsTrue(coll.InternalReificationSubject.IsBlank);
Assert.IsFalse(coll.AcceptDuplicates);

int i = 0;
foreach (RDFPatternMember item in coll) i++;
int i = coll.Count();
Assert.IsTrue(i == 0);

int j = 0;
Expand All @@ -60,8 +60,7 @@ public void ShouldEnumerateCollection(RDFModelEnums.RDFItemTypes itemType)
else
coll.AddItem(new RDFResource("http://item/"));

int i = 0;
foreach (RDFPatternMember item in coll) i++;
int i = coll.Count();
Assert.IsTrue(i == 1);

int j = 0;
Expand Down
7 changes: 3 additions & 4 deletions RDFSharp.Test/Model/RDFContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
using RDFSharp.Model;
using RDFSharp.Query;
using System.Collections.Generic;
using System.Linq;

namespace RDFSharp.Test.Model;

Expand All @@ -42,8 +43,7 @@ public void ShouldCreateEmptyContainer(RDFModelEnums.RDFContainerTypes container
Assert.IsTrue(cont.ItemsCount == 0);
Assert.IsTrue(cont.ReificationSubject.IsBlank);

int i = 0;
foreach (RDFPatternMember item in cont) i++;
int i = cont.Count();
Assert.IsTrue(i == 0);

int j = 0;
Expand All @@ -67,8 +67,7 @@ public void ShouldEnumerateContainer(RDFModelEnums.RDFContainerTypes containerTy
else
cont.AddItem(new RDFResource("http://item/"));

int i = 0;
foreach (RDFPatternMember item in cont) i++;
int i = cont.Count();
Assert.IsTrue(i == 1);

int j = 0;
Expand Down
6 changes: 2 additions & 4 deletions RDFSharp.Test/Model/RDFGraphTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public void ShouldCreateEmptyGraph()
Assert.IsNotNull(graph.Context);
Assert.IsTrue(graph.Context.Equals(RDFNamespaceRegister.DefaultNamespace.NamespaceUri));

int i = 0;
foreach (RDFTriple t in graph) i++;
int i = graph.Count();
Assert.IsTrue(i == 0);

int j = 0;
Expand Down Expand Up @@ -149,8 +148,7 @@ public void ShouldEnumerateGraph()
new RDFTriple(new RDFResource("http://subj/"),new RDFResource("http://pred/"),new RDFPlainLiteral("lit"))
]);

int i = 0;
foreach (RDFTriple t in graph) i++;
int i = graph.Count();
Assert.IsTrue(i == 2);

int j = 0;
Expand Down
4 changes: 1 addition & 3 deletions RDFSharp.Test/Model/Validation/Abstractions/RDFShapeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ public void ShouldAddShapeConstraintAndEnumerate()
while (constraintsEnumerator.MoveNext()) i++;
Assert.IsTrue(i == 1);

int j = 0;
foreach (RDFConstraint constraint in shape)
j++;
int j = shape.Count();
Assert.IsTrue(j == 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public void ShouldAddShapeAndEnumerate()
while (shapesEnumerator.MoveNext()) i++;
Assert.IsTrue(i == 1);

int j = 0;
foreach (RDFShape shp in shapesGraph) j++;
int j = shapesGraph.Count();
Assert.IsTrue(j == 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ You may obtain a copy of the License at
limitations under the License.
*/

using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RDFSharp.Model;

Expand Down Expand Up @@ -56,8 +57,7 @@ public void ShouldCreateBlankNodeShape()
public void ShouldEnumerateNodeShape()
{
RDFNodeShape nodeShape = new RDFNodeShape(new RDFResource("ex:nodeShape"));
int i = 0;
foreach (RDFConstraint constraint in nodeShape) i++;
int i = nodeShape.Count();

Assert.IsTrue(i == 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,7 @@ public void ShouldThrowExceptionOnCreatingPropertyShapeBecauseNullSequencePath()
public void ShouldEnumeratePropertyShape()
{
RDFPropertyShape propertyShape = new RDFPropertyShape(new RDFResource("ex:propertyShape"), RDFVocabulary.FOAF.NAME);
int i = 0;
foreach (RDFConstraint constraint in propertyShape) i++;
int i = propertyShape.Count();

Assert.IsTrue(i == 0);
}
Expand Down
4 changes: 2 additions & 2 deletions RDFSharp.Test/Model/Validation/RDFValidationReportTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ limitations under the License.
using RDFSharp.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RDFSharp.Test.Model;
Expand Down Expand Up @@ -169,8 +170,7 @@ [new RDFPlainLiteral("resultMessage")]
while (resultsEnumerator.MoveNext()) i++;
Assert.IsTrue(i == 1);

int j = 0;
foreach (RDFValidationResult vr in vRep) j++;
int j = vRep.Count();
Assert.IsTrue(j == 1);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2053,7 +2053,7 @@ public void ShouldApplySelectQueryToNullDataSourceAndNotHaveResults()
.AddPrefix(RDFNamespaceRegister.GetByPrefix(RDFVocabulary.RDF.PREFIX))
.AddPatternGroup(new RDFPatternGroup()
.AddPattern(new RDFPattern(new RDFVariable("?S"), RDFVocabulary.RDF.TYPE, RDFVocabulary.RDFS.CLASS)));
RDFSelectQueryResult result = query.ApplyToDataSource(null as RDFGraph);
RDFSelectQueryResult result = query.ApplyToDataSource(null);

Assert.IsNotNull(result);
Assert.IsNotNull(result.SelectResults);
Expand Down
50 changes: 25 additions & 25 deletions RDFSharp.Test/Query/Mirella/RDFQueryEngineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public void ShouldEvaluateSelectQueryOnGraphWithResultsHavingCommonSPOVariables(
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_UnionsThenOptional()
public void ShouldEvaluateSelectQueryOnGraphUnionsThenOptional()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -232,7 +232,7 @@ public void ShouldEvaluateSelectQueryOnGraph_UnionsThenOptional()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_UnionsThenInner()
public void ShouldEvaluateSelectQueryOnGraphUnionsThenInner()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -263,7 +263,7 @@ public void ShouldEvaluateSelectQueryOnGraph_UnionsThenInner()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_MinusPatternGroup()
public void ShouldEvaluateSelectQueryOnGraphMinusPatternGroup()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -315,7 +315,7 @@ ORDER BY ASC(?X)
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_MinusPattern()
public void ShouldEvaluateSelectQueryOnGraphMinusPattern()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -355,7 +355,7 @@ public void ShouldEvaluateSelectQueryOnGraph_MinusPattern()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressions()
public void ShouldEvaluateSelectQueryOnGraphBindAndProjectionExpressions()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -402,7 +402,7 @@ public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressions()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedByBind()
public void ShouldEvaluateSelectQueryOnGraphBindAndProjectionExpressionsSortedByBind()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -449,7 +449,7 @@ public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedB
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedByProjectionExpressions()
public void ShouldEvaluateSelectQueryOnGraphBindAndProjectionExpressionsSortedByProjectionExpressions()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -496,7 +496,7 @@ public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedB
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedByProjectionExpressionsThenByBind()
public void ShouldEvaluateSelectQueryOnGraphBindAndProjectionExpressionsSortedByProjectionExpressionsThenByBind()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -551,7 +551,7 @@ public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedB
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedByBindThenByProjectionExpressions()
public void ShouldEvaluateSelectQueryOnGraphBindAndProjectionExpressionsSortedByBindThenByProjectionExpressions()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -606,7 +606,7 @@ public void ShouldEvaluateSelectQueryOnGraph_BindAndProjectionExpressionsSortedB
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_ProjectionExpressionsSortedByUnboundProjectionExpressions()
public void ShouldEvaluateSelectQueryOnGraphProjectionExpressionsSortedByUnboundProjectionExpressions()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -638,7 +638,7 @@ public void ShouldEvaluateSelectQueryOnGraph_ProjectionExpressionsSortedByUnboun
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_StarWithBind()
public void ShouldEvaluateSelectQueryOnGraphStarWithBind()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -680,7 +680,7 @@ public void ShouldEvaluateSelectQueryOnGraph_StarWithBind()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableConstantExpressionBoundValue()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableConstantExpressionBoundValue()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -697,7 +697,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableConstantExpressionBoundVa
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableConstantExpressionProjectedValue()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableConstantExpressionProjectedValue()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -713,7 +713,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableConstantExpressionProject
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableNowExpressionProjectedValue()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableNowExpressionProjectedValue()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -729,7 +729,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableNowExpressionProjectedVal
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpressionProjectedValue1()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableComplexVariableLessExpressionProjectedValue1()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -747,7 +747,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpres
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpressionProjectedValue2()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableComplexVariableLessExpressionProjectedValue2()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -766,7 +766,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpres
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpressionProjectedValue3()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableComplexVariableLessExpressionProjectedValue3()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -785,7 +785,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableComplexVariableLessExpres
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableRandExpressionProjectedValue()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableRandExpressionProjectedValue()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -801,7 +801,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableRandExpressionProjectedVa
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableFloorExpressionProjectedValue()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableFloorExpressionProjectedValue()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -817,7 +817,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableFloorExpressionProjectedV
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableFloorExpressionProjectedValueFromSubQuery1()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableFloorExpressionProjectedValueFromSubQuery1()
{
RDFGraph graph = new RDFGraph();

Expand All @@ -835,7 +835,7 @@ public void ShouldEvaluateSelectQueryOnGraph_EmptyTableFloorExpressionProjectedV
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnGraph_EmptyTableFloorExpressionProjectedValueFromSubQuery2()
public void ShouldEvaluateSelectQueryOnGraphEmptyTableFloorExpressionProjectedValueFromSubQuery2()
{
RDFGraph graph = new RDFGraph();

Expand Down Expand Up @@ -1554,7 +1554,7 @@ public void ShouldEvaluateSelectQueryOnFederationWithResults()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnFederation_BindAndProjectionExpressions()
public void ShouldEvaluateSelectueryOnFederation_BindAndProjectionExpressions()
{
RDFGraph graph = new RDFGraph(
[
Expand Down Expand Up @@ -1605,7 +1605,7 @@ public void ShouldEvaluateSelectQueryOnFederation_BindAndProjectionExpressions()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpoints()
public void ShouldEvaluateSelectQeryOnFederationWithResults_SPARQLEndpoints()
{
string receivedQuery1 = "";
string receivedQuery2 = "";
Expand Down Expand Up @@ -1733,7 +1733,7 @@ public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpoints()
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpointsOneGivingEmptyResult()
public void ShouldEvaluateSelectQuryOnFederationWithResults_SPARQLEndpointsOneGivingEmptyResult()
{
string receivedQuery1 = "";
string receivedQuery2 = "";
Expand Down Expand Up @@ -1863,7 +1863,7 @@ public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpointsOneG
}

[TestMethod]
public void ShouldEvaluateSelectQueryOnFederationWithResults_SPARQLEndpointsOneThrowingException()
public void ShouldEvaluateSelectQueyOnFederationWithResultsSPARQLEndpointsOneThrowingException()
{
string receivedQuery1 = "";
string receivedQuery2 = "";
Expand Down
Loading

0 comments on commit c246224

Please sign in to comment.