Skip to content

Commit

Permalink
Bunch of 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 2a50bc8 commit 14206d4
Show file tree
Hide file tree
Showing 204 changed files with 110,710 additions and 110,498 deletions.
77 changes: 38 additions & 39 deletions RDFSharp.Test/Model/Facets/RDFLengthFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,53 @@ limitations under the License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RDFSharp.Model;

namespace RDFSharp.Test.Model
namespace RDFSharp.Test.Model;

[TestClass]
public class RDFLengthFacetTest
{
[TestClass]
public class RDFLengthFacetTest
{
#region Tests
[TestMethod]
#region Tests
[TestMethod]

public void ShouldCreateLengthFacet()
{
RDFLengthFacet facet = new RDFLengthFacet(6);
public void ShouldCreateLengthFacet()
{
RDFLengthFacet facet = new RDFLengthFacet(6);

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

[TestMethod]
[TestMethod]

public void ShouldValidateLengthFacet()
{
RDFLengthFacet facet = new RDFLengthFacet(6);
public void ShouldValidateLengthFacet()
{
RDFLengthFacet facet = new RDFLengthFacet(6);

Assert.IsTrue(facet.Validate("abcdef"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("a"));
Assert.IsFalse(facet.Validate("abcdefgh"));
Assert.IsTrue(facet.Validate("abcdef"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("a"));
Assert.IsFalse(facet.Validate("abcdefgh"));

RDFLengthFacet facet0 = new RDFLengthFacet(0);
Assert.IsFalse(facet0.Validate("abcdef"));
Assert.IsTrue(facet0.Validate(null));
Assert.IsTrue(facet0.Validate(string.Empty));
Assert.IsFalse(facet0.Validate("a"));
}
RDFLengthFacet facet0 = new RDFLengthFacet(0);
Assert.IsFalse(facet0.Validate("abcdef"));
Assert.IsTrue(facet0.Validate(null));
Assert.IsTrue(facet0.Validate(string.Empty));
Assert.IsFalse(facet0.Validate("a"));
}

[TestMethod]
[TestMethod]

public void ShouldConvertLengthFacetToGraph()
{
RDFLengthFacet facet = new RDFLengthFacet(6);
RDFGraph graph = facet.ToRDFGraph();
public void ShouldConvertLengthFacetToGraph()
{
RDFLengthFacet facet = new RDFLengthFacet(6);
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
}
77 changes: 38 additions & 39 deletions RDFSharp.Test/Model/Facets/RDFMaxExclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,53 @@ limitations under the License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RDFSharp.Model;

namespace RDFSharp.Test.Model
namespace RDFSharp.Test.Model;

[TestClass]
public class RDFMaxExclusiveFacetTest
{
[TestClass]
public class RDFMaxExclusiveFacetTest
{
#region Tests
[TestMethod]
#region Tests
[TestMethod]

public void ShouldCreateMaxExclusiveFacet()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6.145);
public void ShouldCreateMaxExclusiveFacet()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6.145);

Assert.IsNotNull(facet);
Assert.IsTrue(facet.ExclusiveUpperBound == 6.145d);
Assert.IsTrue(facet.URI.IsBlank);
}
Assert.IsNotNull(facet);
Assert.IsTrue(facet.ExclusiveUpperBound == 6.145d);
Assert.IsTrue(facet.URI.IsBlank);
}

[TestMethod]
[TestMethod]

public void ShouldValidateMaxExclusiveFacet()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6);
public void ShouldValidateMaxExclusiveFacet()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6);

Assert.IsTrue(facet.Validate("-2.0089"));
Assert.IsTrue(facet.Validate("2.047"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("14.5773"));
Assert.IsFalse(facet.Validate("6"));
Assert.IsFalse(facet.Validate("abcdefgh"));
Assert.IsTrue(facet.Validate("-2.0089"));
Assert.IsTrue(facet.Validate("2.047"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("14.5773"));
Assert.IsFalse(facet.Validate("6"));
Assert.IsFalse(facet.Validate("abcdefgh"));

RDFMaxExclusiveFacet facet0 = new RDFMaxExclusiveFacet(-12.45);
Assert.IsTrue(facet0.Validate("-16.2442"));
Assert.IsFalse(facet0.Validate("-12.00"));
}
RDFMaxExclusiveFacet facet0 = new RDFMaxExclusiveFacet(-12.45);
Assert.IsTrue(facet0.Validate("-16.2442"));
Assert.IsFalse(facet0.Validate("-12.00"));
}

[TestMethod]
[TestMethod]

public void ShouldConvertMaxExclusiveFacetToGraph()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6);
RDFGraph graph = facet.ToRDFGraph();
public void ShouldConvertMaxExclusiveFacetToGraph()
{
RDFMaxExclusiveFacet facet = new RDFMaxExclusiveFacet(6);
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
}
77 changes: 38 additions & 39 deletions RDFSharp.Test/Model/Facets/RDFMaxInclusiveFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,54 +18,53 @@ limitations under the License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RDFSharp.Model;

namespace RDFSharp.Test.Model
namespace RDFSharp.Test.Model;

[TestClass]
public class RDFMaxInclusiveFacetTest
{
[TestClass]
public class RDFMaxInclusiveFacetTest
{
#region Tests
[TestMethod]
#region Tests
[TestMethod]

public void ShouldCreateMaxInclusiveFacet()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6.145);
public void ShouldCreateMaxInclusiveFacet()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6.145);

Assert.IsNotNull(facet);
Assert.IsTrue(facet.InclusiveUpperBound == 6.145d);
Assert.IsTrue(facet.URI.IsBlank);
}
Assert.IsNotNull(facet);
Assert.IsTrue(facet.InclusiveUpperBound == 6.145d);
Assert.IsTrue(facet.URI.IsBlank);
}

[TestMethod]
[TestMethod]

public void ShouldValidateMaxInclusiveFacet()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6);
public void ShouldValidateMaxInclusiveFacet()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6);

Assert.IsTrue(facet.Validate("-2.0089"));
Assert.IsTrue(facet.Validate("2.047"));
Assert.IsTrue(facet.Validate("6"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("14.5773"));
Assert.IsFalse(facet.Validate("abcdefgh"));
Assert.IsTrue(facet.Validate("-2.0089"));
Assert.IsTrue(facet.Validate("2.047"));
Assert.IsTrue(facet.Validate("6"));
Assert.IsFalse(facet.Validate(null));
Assert.IsFalse(facet.Validate(string.Empty));
Assert.IsFalse(facet.Validate("14.5773"));
Assert.IsFalse(facet.Validate("abcdefgh"));

RDFMaxInclusiveFacet facet0 = new RDFMaxInclusiveFacet(-12.45);
Assert.IsTrue(facet0.Validate("-16.2442"));
Assert.IsFalse(facet0.Validate("-12.00"));
}
RDFMaxInclusiveFacet facet0 = new RDFMaxInclusiveFacet(-12.45);
Assert.IsTrue(facet0.Validate("-16.2442"));
Assert.IsFalse(facet0.Validate("-12.00"));
}

[TestMethod]
[TestMethod]

public void ShouldConvertMaxInclusiveFacetToGraph()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6);
RDFGraph graph = facet.ToRDFGraph();
public void ShouldConvertMaxInclusiveFacetToGraph()
{
RDFMaxInclusiveFacet facet = new RDFMaxInclusiveFacet(6);
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
}
79 changes: 39 additions & 40 deletions RDFSharp.Test/Model/Facets/RDFMaxLengthFacetTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,55 +18,54 @@ limitations under the License.
using Microsoft.VisualStudio.TestTools.UnitTesting;
using RDFSharp.Model;

namespace RDFSharp.Test.Model
namespace RDFSharp.Test.Model;

[TestClass]
public class RDFMaxLengthFacetTest
{
[TestClass]
public class RDFMaxLengthFacetTest
{
#region Tests
[TestMethod]
#region Tests
[TestMethod]

public void ShouldCreateMaxLengthFacet()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);
public void ShouldCreateMaxLengthFacet()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);

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

[TestMethod]
[TestMethod]

public void ShouldValidateMaxLengthFacet()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);
public void ShouldValidateMaxLengthFacet()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);

Assert.IsTrue(facet.Validate("abcdef"));
Assert.IsTrue(facet.Validate(null));
Assert.IsTrue(facet.Validate(string.Empty));
Assert.IsTrue(facet.Validate("a"));
Assert.IsFalse(facet.Validate("abcdefgh"));
Assert.IsTrue(facet.Validate("abcdef"));
Assert.IsTrue(facet.Validate(null));
Assert.IsTrue(facet.Validate(string.Empty));
Assert.IsTrue(facet.Validate("a"));
Assert.IsFalse(facet.Validate("abcdefgh"));

RDFMaxLengthFacet facet0 = new RDFMaxLengthFacet(0);
Assert.IsFalse(facet0.Validate("abcdef"));
Assert.IsTrue(facet0.Validate(null));
Assert.IsTrue(facet0.Validate(string.Empty));
Assert.IsFalse(facet0.Validate("a"));
Assert.IsFalse(facet0.Validate("abcdefgh"));
}
RDFMaxLengthFacet facet0 = new RDFMaxLengthFacet(0);
Assert.IsFalse(facet0.Validate("abcdef"));
Assert.IsTrue(facet0.Validate(null));
Assert.IsTrue(facet0.Validate(string.Empty));
Assert.IsFalse(facet0.Validate("a"));
Assert.IsFalse(facet0.Validate("abcdefgh"));
}

[TestMethod]
[TestMethod]

public void ShouldConvertMaxLengthFacetToGraph()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);
RDFGraph graph = facet.ToRDFGraph();
public void ShouldConvertMaxLengthFacetToGraph()
{
RDFMaxLengthFacet facet = new RDFMaxLengthFacet(6);
RDFGraph graph = facet.ToRDFGraph();

Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
Assert.IsNotNull(graph);
Assert.IsTrue(graph.TriplesCount == 1);
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()))));
}
#endregion
}
Loading

0 comments on commit 14206d4

Please sign in to comment.