Skip to content

Commit

Permalink
Applied quality suggestions from VS
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco De Salvo committed Feb 10, 2025
1 parent 6f41083 commit afd0619
Show file tree
Hide file tree
Showing 110 changed files with 5,336 additions and 5,336 deletions.
4 changes: 2 additions & 2 deletions RDFSharp.Test/Model/Facets/RDFLengthFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void ShouldCreateLengthFacet()
RDFLengthFacet facet = new RDFLengthFacet(6);

Assert.IsNotNull(facet);
Assert.IsTrue(facet.Length == 6);
Assert.AreEqual(6u, facet.Length);
Assert.IsTrue(facet.URI.IsBlank);
}

Expand Down Expand Up @@ -62,7 +62,7 @@ public void ShouldConvertLengthFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.LENGTH));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.NON_NEGATIVE_INTEGER.ToString()))));
}
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp.Test/Model/Facets/RDFMaxExclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ShouldConvertMaxExclusiveFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MAX_EXCLUSIVE));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.DOUBLE.ToString()))));
}
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp.Test/Model/Facets/RDFMaxInclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ShouldConvertMaxInclusiveFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MAX_INCLUSIVE));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.DOUBLE.ToString()))));
}
Expand Down
4 changes: 2 additions & 2 deletions RDFSharp.Test/Model/Facets/RDFMaxLengthFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void ShouldCreateMaxLengthFacet()
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);

Assert.IsNotNull(facet);
Assert.IsTrue(facet.Length == 6);
Assert.AreEqual(6u, facet.Length);
Assert.IsTrue(facet.URI.IsBlank);
}

Expand Down Expand Up @@ -63,7 +63,7 @@ public void ShouldConvertMaxLengthFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MAX_LENGTH));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.NON_NEGATIVE_INTEGER.ToString()))));
}
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp.Test/Model/Facets/RDFMinExclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void ShouldConvertMinExclusiveFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MIN_EXCLUSIVE));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.DOUBLE.ToString()))));
}
Expand Down
2 changes: 1 addition & 1 deletion RDFSharp.Test/Model/Facets/RDFMinInclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void ShouldConvertMinInclusiveFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MIN_INCLUSIVE));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.DOUBLE.ToString()))));
}
Expand Down
4 changes: 2 additions & 2 deletions RDFSharp.Test/Model/Facets/RDFMinLengthFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void ShouldCreateMinLengthFacet()
RDFMinLengthFacet facet = new RDFMinLengthFacet(6);

Assert.IsNotNull(facet);
Assert.IsTrue(facet.Length == 6);
Assert.AreEqual(6u, facet.Length);
Assert.IsTrue(facet.URI.IsBlank);
}

Expand Down Expand Up @@ -61,7 +61,7 @@ public void ShouldConvertMinLengthFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.MIN_LENGTH));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("6", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.NON_NEGATIVE_INTEGER.ToString()))));
}
Expand Down
4 changes: 2 additions & 2 deletions RDFSharp.Test/Model/Facets/RDFPatternFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void ShouldCreatePatternFacet()
RDFPatternFacet facet = new RDFPatternFacet("^ex");

Assert.IsNotNull(facet);
Assert.IsTrue(facet.Pattern == "^ex");
Assert.AreEqual("^ex", facet.Pattern);
Assert.IsTrue(facet.URI.IsBlank);
}

Expand Down Expand Up @@ -60,7 +60,7 @@ public void ShouldConvertPatternFacetToGraph()
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
Assert.IsTrue(graph.Single().Predicate.Equals(RDFVocabulary.XSD.PATTERN));
Assert.IsTrue(graph.Single().Object.Equals(new RDFTypedLiteral("^ex", RDFDatatypeRegister.GetDatatype(RDFVocabulary.XSD.STRING.ToString()))));
}
Expand Down
44 changes: 22 additions & 22 deletions RDFSharp.Test/Model/RDFCollectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ public void ShouldCreateEmptyCollection(RDFModelEnums.RDFItemTypes itemType)
RDFCollection coll = new RDFCollection(itemType);

Assert.IsNotNull(coll);
Assert.IsTrue(coll.ItemType == itemType);
Assert.IsTrue(coll.ItemsCount == 0);
Assert.AreEqual(itemType, coll.ItemType);
Assert.AreEqual(0, coll.ItemsCount);
Assert.IsTrue(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
Assert.IsTrue(coll.InternalReificationSubject.IsBlank);
Assert.IsFalse(coll.AcceptDuplicates);

int i = coll.Count();
Assert.IsTrue(i == 0);
Assert.AreEqual(0, i);

int j = 0;
IEnumerator<RDFPatternMember> itemsEnumerator = coll.ItemsEnumerator;
while (itemsEnumerator.MoveNext()) j++;
Assert.IsTrue(j == 0);
Assert.AreEqual(0, j);
}

[DataTestMethod]
Expand All @@ -61,12 +61,12 @@ public void ShouldEnumerateCollection(RDFModelEnums.RDFItemTypes itemType)
coll.AddItem(new RDFResource("http://item/"));

int i = coll.Count();
Assert.IsTrue(i == 1);
Assert.AreEqual(1, i);

int j = 0;
IEnumerator<RDFPatternMember> itemsEnumerator = coll.ItemsEnumerator;
while (itemsEnumerator.MoveNext()) j++;
Assert.IsTrue(j == 1);
Assert.AreEqual(1, j);
}

[DataTestMethod]
Expand All @@ -86,7 +86,7 @@ public void ShouldAddItemsToCollection(RDFModelEnums.RDFItemTypes itemType)
coll.AddItem(new RDFResource("http://item/"));
}

Assert.IsTrue(coll.ItemsCount == 1);
Assert.AreEqual(1, coll.ItemsCount);
Assert.IsFalse(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -101,7 +101,7 @@ public void ShouldNotAddItemsToCollectionBecauseWrongType(RDFModelEnums.RDFItemT
else
coll.AddItem(new RDFPlainLiteral("lit"));

Assert.IsTrue(coll.ItemsCount == 0);
Assert.AreEqual(0, coll.ItemsCount);
Assert.IsTrue(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -116,7 +116,7 @@ public void ShouldNotAddItemsToCollectionBecauseNull(RDFModelEnums.RDFItemTypes
else
coll.AddItem(null as RDFResource);

Assert.IsTrue(coll.ItemsCount == 0);
Assert.AreEqual(0, coll.ItemsCount);
Assert.IsTrue(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -139,7 +139,7 @@ public void ShouldRemoveItemsFromCollection(RDFModelEnums.RDFItemTypes itemType)
coll.RemoveItem(new RDFResource("http://item/"));
}

Assert.IsTrue(coll.ItemsCount == 0);
Assert.AreEqual(0, coll.ItemsCount);
Assert.IsTrue(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -162,7 +162,7 @@ public void ShouldNotRemoveItemsFromCollectionBecauseWrongType(RDFModelEnums.RDF
coll.RemoveItem(new RDFPlainLiteral("lit"));
}

Assert.IsTrue(coll.ItemsCount == 1);
Assert.AreEqual(1, coll.ItemsCount);
Assert.IsFalse(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -185,7 +185,7 @@ public void ShouldNotRemoveItemsFromCollectionBecauseNull(RDFModelEnums.RDFItemT
coll.RemoveItem(null as RDFResource);
}

Assert.IsTrue(coll.ItemsCount == 1);
Assert.AreEqual(1, coll.ItemsCount);
Assert.IsFalse(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -207,7 +207,7 @@ public void ShouldClearCollection(RDFModelEnums.RDFItemTypes itemType)
}

coll.ClearItems();
Assert.IsTrue(coll.ItemsCount == 0);
Assert.AreEqual(0, coll.ItemsCount);
Assert.IsTrue(coll.ReificationSubject.Equals(RDFVocabulary.RDF.NIL));
}

Expand All @@ -220,7 +220,7 @@ public void ShouldReifyEmptyCollection(RDFModelEnums.RDFItemTypes itemType)
RDFGraph graph = coll.ReifyCollection();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 0);
Assert.AreEqual(0, graph.TriplesCount);
}

[DataTestMethod]
Expand All @@ -236,7 +236,7 @@ public void ShouldReifyCollectionWithOneItem(RDFModelEnums.RDFItemTypes itemType
RDFGraph graph = coll.ReifyCollection();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 3);
Assert.AreEqual(3, graph.TriplesCount);
Assert.IsTrue(graph.IndexedTriples.ContainsKey(new RDFTriple(coll.ReificationSubject, RDFVocabulary.RDF.TYPE, RDFVocabulary.RDF.LIST).TripleID));

switch (itemType)
Expand Down Expand Up @@ -270,14 +270,14 @@ public void ShouldReifyCollectionWithTwoItems(RDFModelEnums.RDFItemTypes itemTyp
RDFGraph graph = coll.ReifyCollection();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 6);
Assert.IsTrue(graph.SelectTriplesByPredicate(RDFVocabulary.RDF.TYPE)
Assert.AreEqual(6, graph.TriplesCount);
Assert.AreEqual(2, graph.SelectTriplesByPredicate(RDFVocabulary.RDF.TYPE)
.SelectTriplesByObject(RDFVocabulary.RDF.LIST)
.TriplesCount == 2);
Assert.IsTrue(graph.SelectTriplesByPredicate(RDFVocabulary.RDF.FIRST)
.TriplesCount == 2);
Assert.IsTrue(graph.SelectTriplesByPredicate(RDFVocabulary.RDF.REST)
.TriplesCount == 2);
.TriplesCount);
Assert.AreEqual(2, graph.SelectTriplesByPredicate(RDFVocabulary.RDF.FIRST)
.TriplesCount);
Assert.AreEqual(2, graph.SelectTriplesByPredicate(RDFVocabulary.RDF.REST)
.TriplesCount);
}
#endregion
}
38 changes: 19 additions & 19 deletions RDFSharp.Test/Model/RDFContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ public void ShouldCreateEmptyContainer(RDFModelEnums.RDFContainerTypes container
RDFContainer cont = new RDFContainer(containerType, itemType);

Assert.IsNotNull(cont);
Assert.IsTrue(cont.ContainerType == containerType);
Assert.IsTrue(cont.ItemType == itemType);
Assert.IsTrue(cont.ItemsCount == 0);
Assert.AreEqual(containerType, cont.ContainerType);
Assert.AreEqual(itemType, cont.ItemType);
Assert.AreEqual(0, cont.ItemsCount);
Assert.IsTrue(cont.ReificationSubject.IsBlank);

int i = cont.Count();
Assert.IsTrue(i == 0);
Assert.AreEqual(0, i);

int j = 0;
IEnumerator<RDFPatternMember> itemsEnumerator = cont.ItemsEnumerator;
while (itemsEnumerator.MoveNext()) j++;
Assert.IsTrue(j == 0);
Assert.AreEqual(0, j);
}

[DataTestMethod]
Expand All @@ -68,12 +68,12 @@ public void ShouldEnumerateContainer(RDFModelEnums.RDFContainerTypes containerTy
cont.AddItem(new RDFResource("http://item/"));

int i = cont.Count();
Assert.IsTrue(i == 1);
Assert.AreEqual(1, i);

int j = 0;
IEnumerator<RDFPatternMember> itemsEnumerator = cont.ItemsEnumerator;
while (itemsEnumerator.MoveNext()) j++;
Assert.IsTrue(j == 1);
Assert.AreEqual(1, j);
}

[DataTestMethod]
Expand All @@ -100,12 +100,12 @@ public void ShouldAddItemsToContainer(RDFModelEnums.RDFContainerTypes containerT
switch (containerType)
{
case RDFModelEnums.RDFContainerTypes.Alt:
Assert.IsTrue(cont.ItemsCount == 1);
Assert.AreEqual(1, cont.ItemsCount);
break;

case RDFModelEnums.RDFContainerTypes.Bag:
case RDFModelEnums.RDFContainerTypes.Seq:
Assert.IsTrue(cont.ItemsCount == 2);
Assert.AreEqual(2, cont.ItemsCount);
break;
}
}
Expand All @@ -125,7 +125,7 @@ public void ShouldNotAddItemsToContainerBecauseWrongType(RDFModelEnums.RDFContai
else
cont.AddItem(new RDFPlainLiteral("lit"));

Assert.IsTrue(cont.ItemsCount == 0);
Assert.AreEqual(0, cont.ItemsCount);
}

[DataTestMethod]
Expand All @@ -143,7 +143,7 @@ public void ShouldNotAddItemsToContainerBecauseNull(RDFModelEnums.RDFContainerTy
else
cont.AddItem(null as RDFResource);

Assert.IsTrue(cont.ItemsCount == 0);
Assert.AreEqual(0, cont.ItemsCount);
}

[DataTestMethod]
Expand All @@ -169,7 +169,7 @@ public void ShouldRemoveItemsFromContainer(RDFModelEnums.RDFContainerTypes conta
cont.RemoveItem(new RDFResource("http://item/"));
}

Assert.IsTrue(cont.ItemsCount == 0);
Assert.AreEqual(0, cont.ItemsCount);
}

[DataTestMethod]
Expand Down Expand Up @@ -198,12 +198,12 @@ public void ShouldNotRemoveItemsFromContainerBecauseWrongType(RDFModelEnums.RDFC
switch (containerType)
{
case RDFModelEnums.RDFContainerTypes.Alt:
Assert.IsTrue(cont.ItemsCount == 1);
Assert.AreEqual(1, cont.ItemsCount);
break;

case RDFModelEnums.RDFContainerTypes.Bag:
case RDFModelEnums.RDFContainerTypes.Seq:
Assert.IsTrue(cont.ItemsCount == 2);
Assert.AreEqual(2, cont.ItemsCount);
break;
}
}
Expand Down Expand Up @@ -234,12 +234,12 @@ public void ShouldNotRemoveItemsFromContainerBecauseNull(RDFModelEnums.RDFContai
switch (containerType)
{
case RDFModelEnums.RDFContainerTypes.Alt:
Assert.IsTrue(cont.ItemsCount == 1);
Assert.AreEqual(1, cont.ItemsCount);
break;

case RDFModelEnums.RDFContainerTypes.Bag:
case RDFModelEnums.RDFContainerTypes.Seq:
Assert.IsTrue(cont.ItemsCount == 2);
Assert.AreEqual(2, cont.ItemsCount);
break;
}
}
Expand All @@ -266,7 +266,7 @@ public void ShouldClearContainer(RDFModelEnums.RDFContainerTypes containerType,
}

cont.ClearItems();
Assert.IsTrue(cont.ItemsCount == 0);
Assert.AreEqual(0, cont.ItemsCount);
}

[DataTestMethod]
Expand All @@ -282,7 +282,7 @@ public void ShouldReifyEmptyContainer(RDFModelEnums.RDFContainerTypes containerT
RDFGraph graph = cont.ReifyContainer();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
Assert.AreEqual(1, graph.TriplesCount);
switch (containerType)
{
case RDFModelEnums.RDFContainerTypes.Alt:
Expand Down Expand Up @@ -320,7 +320,7 @@ public void ShouldReifyContainer(RDFModelEnums.RDFContainerTypes containerType,
RDFGraph graph = cont.ReifyContainer();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 3);
Assert.AreEqual(3, graph.TriplesCount);
switch (containerType)
{
case RDFModelEnums.RDFContainerTypes.Alt:
Expand Down
Loading

0 comments on commit afd0619

Please sign in to comment.