Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/more simple extensions #10

Merged
merged 21 commits into from
Aug 21, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Path tests for Linux OS
cb-martinsmith committed Aug 21, 2024
commit 26773a068ebd6109031862e0409ea03ae6604d5f
2 changes: 1 addition & 1 deletion .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ run-name: CIBuild_${{ github.event_name }}_${{ github.ref_name }}_${{ github.run

env:
PKG_MAJOR_VERSION: 1.2
PROJECT_NAME: 'DNX.Extensions'
PROJECT_NAME: DNX.Extensions
DOTNET_VERSION: 8.0.x
NUGET_VERSION: 5.x
BUILD_CONFIG: Release
9 changes: 9 additions & 0 deletions tests/DNX.Extensions.Tests/Configuration/EnvironmentConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using DNX.Extensions.Linq;

namespace DNX.Extensions.Tests.Configuration;
public class EnvironmentConfig
{
public static bool IsLinuxStyleFileSystem => Environment.OSVersion.Platform.IsOneOf(PlatformID.Unix, PlatformID.MacOSX);

public static bool IsWindowsStyleFileSystem => Environment.OSVersion.Platform.ToString().StartsWith("Win");
}
6 changes: 3 additions & 3 deletions tests/DNX.Extensions.Tests/IO/DirectoryInfoTests.cs
Original file line number Diff line number Diff line change
@@ -248,13 +248,13 @@ public static TheoryData<string, string, string> GetRelativePath_Data()
{ Path.Combine(Path.GetTempPath(), "folder1"), Path.Combine(Path.GetTempPath(), "folder2"), Path.Combine("..", "folder1") },
};

if (Environment.OSVersion.Platform.ToString().StartsWith("Win"))
if (Configuration.EnvironmentConfig.IsWindowsStyleFileSystem)
{
data.Add(Path.Combine(Path.GetTempPath(), "folder1"), Path.Combine("D:", "folder2"), Path.Combine(Path.GetTempPath(), "folder1"));
}
else if (Environment.OSVersion.Platform.IsOneOf(PlatformID.Unix, PlatformID.MacOSX))
else if (Configuration.EnvironmentConfig.IsLinuxStyleFileSystem)
{
data.Add(Path.Combine(Path.GetTempPath(), "folder1"), Path.Combine("/etc", "folder2"), Path.Combine(Path.GetTempPath(), "folder1"));
data.Add(Path.Combine(Path.GetTempPath(), "folder1"), Path.Combine("/etc", "folder2"), Path.Combine("..", "..", Path.GetTempPath(), "folder1"));
}

return data;
10 changes: 7 additions & 3 deletions tests/DNX.Extensions.Tests/IO/FileInfoExtensionsTests.cs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ private static string DriveRoot1
{
get
{
return Environment.OSVersion.Platform.IsOneOf(PlatformID.Unix, PlatformID.MacOSX)
return Configuration.EnvironmentConfig.IsLinuxStyleFileSystem
? "/root1"
: "C:";
}
@@ -22,7 +22,7 @@ private static string DriveRoot2
{
get
{
return Environment.OSVersion.Platform.IsOneOf(PlatformID.Unix, PlatformID.MacOSX)
return Configuration.EnvironmentConfig.IsLinuxStyleFileSystem
? "/root2"
: "D:";
}
@@ -142,7 +142,11 @@ public static TheoryData<string, string, string> GetRelativeFilePath_Data()
{ Path.Combine(DriveRoot1, "Temp", "abcdefg", "dir3", "file1.tf"), Path.Combine(DriveRoot1, "Temp", "abcdefg"), "dir3" },
{ Path.Combine(DriveRoot1, "Temp", "abcdefg", "dir3", "file1.tf"), Path.Combine(DriveRoot1, "Temp", "abcdefg", "dir3"), "" },
{ Path.Combine(DriveRoot1, "Temp", "folder1", "file.txt"), Path.Combine(DriveRoot1, "Temp", "folder2"), Path.Combine("..", "folder1") },
{ Path.Combine(DriveRoot1, "Temp", "folder1", "file.txt"), Path.Combine(DriveRoot2, "folder2"), Path.Combine(DriveRoot1, "Temp", "folder1") },
{ Path.Combine(DriveRoot1, "Temp", "folder1", "file.txt"), Path.Combine(DriveRoot2, "folder2"),
Configuration.EnvironmentConfig.IsLinuxStyleFileSystem
? Path.Combine("..", "..", DriveRoot1, "Temp", "folder1")
: Path.Combine(DriveRoot1, "Temp", "folder1")
},
};
}
}