fix: handle case-sensitive file overwrite on Windows and add tests#1259
Merged
mergify[bot] merged 3 commits intoTestableIO:mainfrom Apr 4, 2025
Merged
Conversation
test: add tests for Windows file copy behavior
1277a9c to
fc24241
Compare
vbreuss
approved these changes
Apr 4, 2025
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileMoveTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileMoveTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockFileCopyTests.cs
Outdated
Show resolved
Hide resolved
|
This is addressed in release v22.0.13. |
Contributor
Author
|
Thanks! Looking forward to contributing more. |
siprbaum
reviewed
Apr 22, 2025
| throw CommonExceptions.FileAlreadyExists(destFileName); | ||
| } | ||
|
|
||
| if (string.Equals(sourceFileName, destFileName, StringComparison.OrdinalIgnoreCase) && XFS.IsWindowsPlatform()) |
Contributor
There was a problem hiding this comment.
in all the other cases we use
mockFileDataAccessor.StringOperations.Equals(sourceFileName, destinationFileName) instead of relying on
string.Equals(..., ..., StringComparison.OrdinalIgnoreCase)
Is intentional or an oversight?
Member
There was a problem hiding this comment.
This seems to be an oversight.
We had one case here where we used string.Equals on purpose, as it should compare case-sensitive in all operating systems, but here it seems I overlooked it.
This was referenced Aug 1, 2025
This was referenced Aug 11, 2025
This was referenced Aug 19, 2025
This was referenced Sep 1, 2025
This was referenced Sep 8, 2025
Closed
Bump TestableIO.System.IO.Abstractions.Wrappers from 22.0.11 to 22.0.16
maxisoft-gaming/WowAHaha#120
Open
This was referenced Oct 27, 2025
This was referenced Nov 9, 2025
This was referenced Dec 8, 2025
This was referenced Dec 22, 2025
This was referenced Dec 29, 2025
This was referenced Jan 11, 2026
This was referenced Feb 1, 2026
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.
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
System.IO.File.CopySystem.IO.File.MoveandSystem.IO.File.Replacebehavior.Testing