-
Couldn't load subscription status.
- Fork 266
fix: Directory.Move fails on Windows if destination has different case from source
#1256
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
fix: Directory.Move fails on Windows if destination has different case from source
#1256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why we would need this, as this method should only be a wrapper around the native Directory.Move. The idea of this library is to not change the behaviour of the underlying file system!
|
I added this check to handle this issue As it states, the wrapper class and the mock class differ in behaviour. |
|
@oni-shiro: I assigned #1138 to you. |
d6051d5 to
f46f5d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add a test (see #1138) to verify the changed behavior?
Sure will do that. |
f46f5d6 to
bd19fcd
Compare
|
Added the test, removed two outdated tests that does not align with this change. @vbreuss |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oni-shiro I fear you misunderstood #1138. It mentions only the case that source and destination differ in casing and only on windows. You should not remove the existing test cases, as they verify the correct behavior in other cases that should not be changed.
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs
Outdated
Show resolved
Hide resolved
d843e9d to
1778c08
Compare
|
Thank you @vbreuss for pointing my mistake 👍. I have made new changes, for this I had to add another Let me know your thoughts. |
0863aad to
b526929
Compare
I don't like this additional overload in the |
I was not keen on using Both StringOperations.Equals, and string.Equals simultaneously to avoid any confusion. But I understand your point, I will revert the change for that. |
|
Reverted the public api related changes on 402f597 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @oni-shiro, I only have some minor suggestions.
src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs
Outdated
Show resolved
Hide resolved
src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs
Outdated
Show resolved
Hide resolved
Directory.Move fails on Windows if destination has different case from source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adjusted the title and description, as they were no longer up-to-date.
The PR looks good to me. Will release it shortly!
|
This is addressed in release v22.0.14. |

This PR address the issue #1138:
On Windows,
MockFileSystem.Directory.Moveno longer throws aSystem.IO.IOExceptionwhen source and destination path only differ in casing.