Tags: TestableIO/System.IO.Abstractions
Tags
fix: MockFileSystem's File.WriteAllText, File.ReadAllText, Directory.… …GetFiles, Directory.Create fail with \\?\C:\foo style paths (#1305) * Test that MockDirectory.CreateDirectory supports windows extended-length paths Windows paths can have a `\\?\` prefix, the '?' character is not always invalid. Ref: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry Refers to #1304 * Make MockDirectory_CreateDirectory_ShouldSupportExtendedLengthPaths pass Fixes #1304 * Also test that MockDirectory.CreateDirectory with an extended path returns a DirectoryInfo with an extended path * Make MockFileSystem's File.WriteAllText, File.ReadAllText and Directory.GetFiles support extended length paths too * Refactor a little --------- Co-authored-by: Valentin Breuß <vbreuss@gmail.com>
fix: handle case-sensitive file overwrite on Windows and add tests (#… …1259) This PR fixes an issue (#1140) where copying a file with the same name but different casing on Windows resulted in an "already in use" error. It aligns the behavior with the native file system. ## Changes - Fixed file overwrite logic to properly handle case-insensitive paths on Windows. - Added Windows-specific checks to mimic `System.IO.File.Copy` `System.IO.File.Move` and `System.IO.File.Replace` behavior. - Implemented test cases to verify expected behavior for case-sensitive and case-insensitive file systems. - Ensured that the fix does not affect Linux behavior. ## Testing - Verified that the fix works correctly on Windows by checking file existence before and after copying,moving and replacing file with different cases - Ran test cases on both Windows and Linux to ensure no unintended side effects.
fix: Make MockDirectory.Exists behavior with forward slash on Windows… … consistent with actual file system (#1245) # Changes - Removed Unix OS check in `MockDirectory.Exists` - Added additional tests for `MockDirectory`, `MockDirectoryInfo`, `FileSystem.Directory`
fix: move a read-only file (#1239) Fixes the bug reported in #1207 (which was introduced in #870) that it is not possible to move a read-only file: The `AddFile` and `RemoveFile` now have an optional parameter `verifyAccess` which if set to `false` will omit the access check, thus not throwing the `UnauthorizedAccessException`.
refactor: support pre-release versions (#1224) Support creating pre-release nuget packages.
feat: add new `File` methods from .NET 9 (#1193) - Task AppendAllBytesAsync(string, byte[], CancellationToken) - Task AppendAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) - Task AppendAllTextAsync(string, ReadOnlyMemory<char>, Encoding, CancellationToken) - Task AppendAllTextAsync(string, ReadOnlyMemory<char>, CancellationToken) - Task WriteAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken) - Task WriteAllTextAsync(string, ReadOnlyMemory<char>, Encoding, CancellationToken) - Task WriteAllTextAsync(string, ReadOnlyMemory<char>, CancellationToken) - void AppendAllBytes(string, byte[]) - void AppendAllBytes(string, ReadOnlySpan<byte>) - void AppendAllText(string, ReadOnlySpan<char>) - void AppendAllText(string, ReadOnlySpan<char>, Encoding) - void WriteAllBytes(string, ReadOnlySpan<byte>) - void WriteAllText(string, ReadOnlySpan<char>) - void WriteAllText(string, ReadOnlySpan<char>, Encoding)
PreviousNext