Browse Source

Fix tests on linux

pull/438/head
Ionite 10 months ago
parent
commit
5db1e6e428
No known key found for this signature in database
  1. 33
      StabilityMatrix.Tests/Core/FileSystemPathTests.cs

33
StabilityMatrix.Tests/Core/FileSystemPathTests.cs

@ -1,13 +1,36 @@
using StabilityMatrix.Core.Models.FileInterfaces; using System.Runtime.Versioning;
using StabilityMatrix.Core.Models.FileInterfaces;
namespace StabilityMatrix.Tests.Core; namespace StabilityMatrix.Tests.Core;
[TestClass] [TestClass]
public class FileSystemPathTests public class FileSystemPathTests
{ {
[SupportedOSPlatform("windows")]
[DataTestMethod] [DataTestMethod]
[DataRow("M:\\Path", "M:\\Path")] [DataRow("M:\\Path", "M:\\Path")]
[DataRow("root/abc", "root/abc")]
[DataRow("root\\abc", "root\\abc")] [DataRow("root\\abc", "root\\abc")]
public void TestFilePathEqualsWin(string left, string right)
{
// Arrange
var leftPath = new FilePath(left);
var rightPath = new FilePath(right);
// Act
var resultEquals = leftPath.Equals(rightPath);
var resultOperator = leftPath == rightPath;
var resultNotOperator = leftPath != rightPath;
// Assert
Assert.IsTrue(resultEquals);
Assert.IsTrue(resultOperator);
Assert.IsFalse(resultNotOperator);
}
[DataTestMethod]
[DataRow("M:/Path", "M:/Path")]
[DataRow("root/abc", "root/abc")]
[DataRow("root/abc", "root/abc")] [DataRow("root/abc", "root/abc")]
public void TestFilePathEquals(string left, string right) public void TestFilePathEquals(string left, string right)
{ {
@ -27,8 +50,8 @@ public class FileSystemPathTests
} }
[DataTestMethod] [DataTestMethod]
[DataRow("M:\\Path", "M:\\Path2")] [DataRow("M:/Path", "M:/Path2")]
[DataRow("root\\abc", "root\\abc2")] [DataRow("root/abc", "root/abc2")]
public void TestFilePathNotEquals(string left, string right) public void TestFilePathNotEquals(string left, string right)
{ {
// Arrange // Arrange
@ -47,8 +70,8 @@ public class FileSystemPathTests
} }
[DataTestMethod] [DataTestMethod]
[DataRow("M:\\Path", "M:\\Path")] [DataRow("M:/Path", "M:/Path")]
[DataRow("M:\\Path", "M:\\Path\\")] [DataRow("M:/Path", "M:/Path/")]
[DataRow("root/abc", "root/abc")] [DataRow("root/abc", "root/abc")]
[DataRow("root/abc", "root/abc/")] [DataRow("root/abc", "root/abc/")]
public void TestDirectoryPathEquals(string left, string right) public void TestDirectoryPathEquals(string left, string right)

Loading…
Cancel
Save