fix: fixed removing current directory not throwing ioexception#940
Open
pw-sgr wants to merge 10 commits intoTestably:mainfrom
Open
fix: fixed removing current directory not throwing ioexception#940pw-sgr wants to merge 10 commits intoTestably:mainfrom
pw-sgr wants to merge 10 commits intoTestably:mainfrom
Conversation
vbreuss
reviewed
Feb 17, 2026
Tests/Testably.Abstractions.Tests/FileSystem/Directory/RemoveCurrentDirectoryTests.cs
Outdated
Show resolved
Hide resolved
Tests/Testably.Abstractions.Tests/FileSystem/Directory/RemoveCurrentDirectoryTests.cs
Outdated
Show resolved
Hide resolved
Tests/Testably.Abstractions.Tests/FileSystem/Directory/RemoveCurrentDirectoryTests.cs
Outdated
Show resolved
Hide resolved
Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs
Outdated
Show resolved
Hide resolved
vbreuss
reviewed
Feb 17, 2026
Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
Outdated
Show resolved
Hide resolved
Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR aligns MockFileSystem behavior with Windows by preventing delete/move operations on the current working directory (or its parents) and throwing the same IOException patterns observed on the real file system (per #939).
Changes:
- Added Windows-specific tests asserting
IOExceptionwhen deleting the current directory (and nested current directory) via bothDirectoryandDirectoryInfo. - Added Windows-specific tests asserting
IOExceptionwhen moving the current directory (and when the current directory is nested under the moved directory) via bothDirectoryandDirectoryInfo. - Implemented Windows-only “current directory handle” validations in
InMemoryStorageand introduced new exception factory helpers.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs | Adds Windows-only coverage for moving current directory scenarios. |
| Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs | Adds Windows-only coverage for deleting current directory scenarios. |
| Tests/Testably.Abstractions.Tests/FileSystem/Directory/MoveTests.cs | Adds Windows-only coverage for moving current directory scenarios. |
| Tests/Testably.Abstractions.Tests/FileSystem/Directory/DeleteTests.cs | Adds Windows-only coverage for deleting current directory scenarios. |
| Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs | Adds Windows-only validations that block delete/move when CWD is affected. |
| Source/Testably.Abstractions.Testing/Helpers/ExceptionFactory.cs | Adds new helper exception constructors used by the new validations. |
Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/MoveToTests.cs
Show resolved
Hide resolved
Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs
Outdated
Show resolved
Hide resolved
Source/Testably.Abstractions.Testing/Storage/InMemoryStorage.cs
Outdated
Show resolved
Hide resolved
Tests/Testably.Abstractions.Tests/FileSystem/DirectoryInfo/DeleteTests.cs
Show resolved
Hide resolved
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #939