Skip to content

fix: fixed removing current directory not throwing ioexception#940

Merged
vbreuss merged 10 commits intoTestably:mainfrom
pw-sgr:939-fix-throw-ioexception-when-deleting-current-directory
Feb 19, 2026
Merged

fix: fixed removing current directory not throwing ioexception#940
vbreuss merged 10 commits intoTestably:mainfrom
pw-sgr:939-fix-throw-ioexception-when-deleting-current-directory

Conversation

@pw-sgr
Copy link
Contributor

@pw-sgr pw-sgr commented Feb 17, 2026

Closes #939

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 IOException when deleting the current directory (and nested current directory) via both Directory and DirectoryInfo.
  • Added Windows-specific tests asserting IOException when moving the current directory (and when the current directory is nested under the moved directory) via both Directory and DirectoryInfo.
  • Implemented Windows-only “current directory handle” validations in InMemoryStorage and 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.

@vbreuss vbreuss merged commit c1bd7a3 into Testably:main Feb 19, 2026
11 checks passed
@vbreuss
Copy link
Member

vbreuss commented Feb 19, 2026

Thanks, @pw-sgr, I will create a release shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Throw IOException when deleting current directory

2 participants

Comments