Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Semantics.Quantities/Semantics.Quantities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0;net7.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Polyfill" />
</ItemGroup>

</Project>
3 changes: 0 additions & 3 deletions Semantics.Strings/Semantics.Strings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,5 @@
<!-- CA2249: Consider using String.Contains instead of String.IndexOf -->
<!-- IDE0057: Substring can be simplified -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Polyfill" />
</ItemGroup>

</Project>
5 changes: 5 additions & 0 deletions Semantics.Test/Parallelization.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Copyright (c) ktsu.dev
// All rights reserved.
// Licensed under the MIT license.

[assembly: Parallelize(Scope = ExecutionScope.MethodLevel)]
12 changes: 6 additions & 6 deletions Semantics.Test/Paths/PathIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void MixedPathTypes_InCollection_WorkCorrectly()
FilePath.Create<FilePath>("any.txt")
];

Assert.AreEqual(6, paths.Count);
Assert.HasCount(6, paths);
foreach (IPath path in paths)
{
Assert.IsNotNull(path);
Expand All @@ -45,8 +45,8 @@ public void DirectoryNames_InCollection_WorkCorrectly()
DirectoryName.Create<DirectoryName>("folder3")
];

Assert.AreEqual(3, names.Count);
Assert.IsTrue(names.Contains(DirectoryName.Create<DirectoryName>("folder1")));
Assert.HasCount(3, names);
Assert.Contains(DirectoryName.Create<DirectoryName>("folder1"), names);
}

[TestMethod]
Expand All @@ -60,7 +60,7 @@ public void DirectoryNames_AsSet_WorkCorrectly()
DirectoryName.Create<DirectoryName>("folder1") // Duplicate
];

Assert.AreEqual(2, uniqueNames.Count); // Duplicate should be ignored
Assert.HasCount(2, uniqueNames); // Duplicate should be ignored
}

[TestMethod]
Expand Down Expand Up @@ -185,8 +185,8 @@ public void DirectoryDepth_Comparison_WorksCorrectly()
RelativeDirectoryPath medium = RelativeDirectoryPath.Create<RelativeDirectoryPath>(@"a\b");
RelativeDirectoryPath deep = RelativeDirectoryPath.Create<RelativeDirectoryPath>(@"a\b\c");

Assert.IsTrue(shallow.Depth < medium.Depth);
Assert.IsTrue(medium.Depth < deep.Depth);
Assert.IsLessThan(medium.Depth, shallow.Depth);
Assert.IsLessThan(deep.Depth, medium.Depth);
Assert.AreEqual(0, shallow.Depth);
Assert.AreEqual(1, medium.Depth);
Assert.AreEqual(2, deep.Depth);
Expand Down
4 changes: 2 additions & 2 deletions Semantics.Test/PhysicalQuantityCoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ public void CompareTo_And_Equals_Behavior()
{
Length<double> a = Length<double>.Create(1.0);
Length<double> b = Length<double>.Create(2.0);
Assert.IsTrue(a.CompareTo(b) < 0);
Assert.IsTrue(b.CompareTo(a) > 0);
Assert.IsLessThan(0, a.CompareTo(b));
Assert.IsGreaterThan(0, b.CompareTo(a));
Assert.IsTrue(a.Equals(Length<double>.Create(1.0)));

IPhysicalQuantity<double> other = new FakeQuantity();
Expand Down
2 changes: 1 addition & 1 deletion Semantics.Test/ReflectionCoefficientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void AtObliqueIncidence_ShouldReduceReflectionComparedToNormal_ForSmallAn
ReflectionCoefficient<double> rOblique = ReflectionCoefficient<double>.AtObliqueIncidence(angleRad, ratio);
double rNormal = (ratio - 1.0) / (ratio + 1.0);

Assert.IsTrue(rOblique.Value < rNormal);
Assert.IsLessThan(rNormal, rOblique.Value);
}
}

22 changes: 11 additions & 11 deletions Semantics.Test/SemanticPathInterfaceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,17 @@ public void DirectoryPath_Contents_ReturnsCorrectPathTypes()
DirectoryPath dirPath = DirectoryPath.Create<DirectoryPath>(testDir);
IPath[] contents = [.. dirPath.GetContents()];

Assert.IsTrue(contents.Length > 0, "Contents should not be empty");
Assert.AreEqual(3, contents.Length, "Should contain 2 files and 1 directory");
Assert.IsNotEmpty(contents, "Contents should not be empty");
Assert.HasCount(3, contents, "Should contain 2 files and 1 directory");

// Verify file types
IFilePath[] files = [.. contents.OfType<IFilePath>()];
Assert.AreEqual(2, files.Length, "Should contain 2 files");
Assert.HasCount(2, files, "Should contain 2 files");
Assert.IsTrue(files.All(f => f is FilePath), "Files should be FilePath type");

// Verify directory types
IDirectoryPath[] directories = [.. contents.OfType<IDirectoryPath>()];
Assert.AreEqual(1, directories.Length, "Should contain 1 directory");
Assert.HasCount(1, directories, "Should contain 1 directory");
Assert.IsTrue(directories.All(d => d is DirectoryPath), "Directories should be DirectoryPath type");
}
finally
Expand Down Expand Up @@ -475,17 +475,17 @@ public void AbsoluteDirectoryPath_Contents_ReturnsAbsolutePathTypes()
AbsoluteDirectoryPath absDir = AbsoluteDirectoryPath.Create<AbsoluteDirectoryPath>(testDir);
IPath[] contents = [.. absDir.GetContents()];

Assert.IsTrue(contents.Length > 0, "Contents should not be empty");
Assert.AreEqual(2, contents.Length, "Should contain 1 file and 1 directory");
Assert.IsNotEmpty(contents, "Contents should not be empty");
Assert.HasCount(2, contents, "Should contain 1 file and 1 directory");

// Verify file types are absolute
IAbsoluteFilePath[] absoluteFiles = [.. contents.OfType<IAbsoluteFilePath>()];
Assert.AreEqual(1, absoluteFiles.Length, "Should contain 1 absolute file");
Assert.HasCount(1, absoluteFiles, "Should contain 1 absolute file");
Assert.IsTrue(absoluteFiles.All(f => f is AbsoluteFilePath), "Files should be AbsoluteFilePath type");

// Verify directory types are absolute
IAbsoluteDirectoryPath[] absoluteDirectories = [.. contents.OfType<IAbsoluteDirectoryPath>()];
Assert.AreEqual(1, absoluteDirectories.Length, "Should contain 1 absolute directory");
Assert.HasCount(1, absoluteDirectories, "Should contain 1 absolute directory");
Assert.IsTrue(absoluteDirectories.All(d => d is AbsoluteDirectoryPath), "Directories should be AbsoluteDirectoryPath type");
}
finally
Expand Down Expand Up @@ -554,12 +554,12 @@ public void DirectoryPath_Contents_PolymorphicUsage()
IEnumerable<IPath> contents = dirPath.GetContents();

List<IPath> contentsList = [.. contents];
Assert.IsTrue(contentsList.Count != 0, "Contents should not be empty");
Assert.AreEqual(2, contentsList.Count, "Should contain 2 files");
Assert.IsNotEmpty(contentsList, "Contents should not be empty");
Assert.HasCount(2, contentsList, "Should contain 2 files");

// Test filtering by type
IFilePath[] files = [.. contents.OfType<IFilePath>()];
Assert.AreEqual(2, files.Length, "Should be able to filter files polymorphically");
Assert.HasCount(2, files, "Should be able to filter files polymorphically");

// Test that all returned items are paths
Assert.IsTrue(contentsList.All(item => item is not null), "All contents should implement IPath");
Expand Down
6 changes: 3 additions & 3 deletions Semantics.Test/SemanticStringTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public void StaticToCharArray_WithNullSemanticString()
{
MySemanticString? nullSemanticString = null;
char[] result = SemanticString<MySemanticString>.ToCharArray(nullSemanticString);
Assert.AreEqual(0, result.Length);
Assert.IsEmpty(result);
}

[TestMethod]
Expand All @@ -329,7 +329,7 @@ public void ImplicitConversions_WithNull()
ReadOnlySpan<char> spanResult = nullSemanticString;

Assert.AreEqual(string.Empty, stringResult);
Assert.AreEqual(0, charArrayResult.Length);
Assert.IsEmpty(charArrayResult);
Assert.IsTrue(spanResult.IsEmpty);
}

Expand Down Expand Up @@ -1227,7 +1227,7 @@ public void StaticMethods_WithNullSemanticString_HandleGracefully()
Assert.AreEqual(string.Empty, result);

char[] charResult = SemanticString<MySemanticString>.ToCharArray(null);
Assert.AreEqual(0, charResult.Length);
Assert.IsEmpty(charResult);

ReadOnlySpan<char> spanResult = SemanticString<MySemanticString>.ToReadOnlySpan(null);
Assert.IsTrue(spanResult.IsEmpty);
Expand Down
4 changes: 1 addition & 3 deletions Semantics.Test/Semantics.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
<TestingPlatformShowTestsFailureDetails>true</TestingPlatformShowTestsFailureDetails>
<NoWarn>$(NoWarn);MSTEST0032</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" />
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" />
<ProjectReference Include="..\Semantics.Strings\Semantics.Strings.csproj" />
<ProjectReference Include="..\Semantics.Paths\Semantics.Paths.csproj" />
<ProjectReference Include="..\Semantics.Quantities\Semantics.Quantities.csproj" />
Expand Down
Loading