diff --git a/Source/Testably.Abstractions.Testing/Storage/InMemoryContainer.cs b/Source/Testably.Abstractions.Testing/Storage/InMemoryContainer.cs
index 654005f8..a557753f 100644
--- a/Source/Testably.Abstractions.Testing/Storage/InMemoryContainer.cs
+++ b/Source/Testably.Abstractions.Testing/Storage/InMemoryContainer.cs
@@ -92,7 +92,10 @@ public IFileSystemExtensibility Extensibility
#if FEATURE_FILESYSTEM_UNIXFILEMODE
///
- public UnixFileMode UnixFileMode { get; set; } = (UnixFileMode)(-1);
+ public UnixFileMode UnixFileMode { get; set; } = UnixFileMode.OtherRead |
+ UnixFileMode.GroupRead |
+ UnixFileMode.UserWrite |
+ UnixFileMode.UserRead;
#endif
///
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/File/UnixFileModeTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/File/UnixFileModeTests.cs
index 190b6d3b..ea2370ac 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/File/UnixFileModeTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/File/UnixFileModeTests.cs
@@ -8,6 +8,26 @@ public abstract partial class UnixFileModeTests
: FileSystemTestBase
where TFileSystem : IFileSystem
{
+ [SkippableTheory]
+ [AutoData]
+ public void GetUnixFileMode_ShouldBeInitializedCorrectly(
+ string path)
+ {
+ Skip.If(Test.RunsOnWindows);
+
+ FileSystem.File.WriteAllText(path, "");
+ UnixFileMode expected = UnixFileMode.OtherRead |
+ UnixFileMode.GroupRead |
+ UnixFileMode.UserWrite |
+ UnixFileMode.UserRead;
+
+ #pragma warning disable CA1416
+ UnixFileMode result = FileSystem.File.GetUnixFileMode(path);
+ #pragma warning restore CA1416
+
+ result.Should().Be(expected);
+ }
+
[SkippableTheory]
[AutoData]
public void GetUnixFileMode_ShouldThrowPlatformNotSupportedException_OnWindows(
diff --git a/Tests/Testably.Abstractions.Tests/FileSystem/FileSystemInfo/UnixFileModeTests.cs b/Tests/Testably.Abstractions.Tests/FileSystem/FileSystemInfo/UnixFileModeTests.cs
index 62766dbc..1269bfa6 100644
--- a/Tests/Testably.Abstractions.Tests/FileSystem/FileSystemInfo/UnixFileModeTests.cs
+++ b/Tests/Testably.Abstractions.Tests/FileSystem/FileSystemInfo/UnixFileModeTests.cs
@@ -40,12 +40,15 @@ public void UnixFileMode_SetterShouldThrowPlatformNotSupportedException_OnWindow
[SkippableTheory]
[AutoData]
- public void UnixFileMode_ShouldBeInitializedToMinusOne(
+ public void UnixFileMode_ShouldBeInitializedCorrectly(
string path)
{
- Skip.IfNot(Test.RunsOnWindows);
+ Skip.If(Test.RunsOnWindows);
- UnixFileMode expected = (UnixFileMode)(-1);
+ UnixFileMode expected = UnixFileMode.OtherRead |
+ UnixFileMode.GroupRead |
+ UnixFileMode.UserWrite |
+ UnixFileMode.UserRead;
FileSystem.File.WriteAllText(path, "some content");
IFileInfo fileSystemInfo = FileSystem.FileInfo.New(path);