-
Notifications
You must be signed in to change notification settings - Fork 257
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: prefix bug in MockDirectory.EnumerateDirectories (#815) #1046
fix: prefix bug in MockDirectory.EnumerateDirectories (#815) #1046
Conversation
`System.IO.Directory.EnumerateDirectories(path)` guarantees that returned paths are always prefixed with the value provided in the `path` parameter. However, `MockDirectory.EnumerateDirectories` always returned absolute paths, leading to an inconsistent behavior (e.g. when using relative paths). We now check returned paths from `MockDirectory.EnumerateDirectories` and provide the proper prefix path.
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.
@Phoenox:
Thanks for this correction, but please make sure, that it also works on Windows, because this library should target all platforms :-)
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs
Outdated
Show resolved
Hide resolved
tests/TestableIO.System.IO.Abstractions.TestingHelpers.Tests/MockDirectoryTests.cs
Outdated
Show resolved
Hide resolved
src/TestableIO.System.IO.Abstractions.TestingHelpers/MockDirectory.cs
Outdated
Show resolved
Hide resolved
…415) Reproduce the finding from TestableIO/System.IO.Abstractions#1046
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.
Looks good 😊
Thanks @Phoenox
Thanks for the fix @Phoenox, please have a look at the failing ubuntu and macOS tests 🙇 |
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.
Sorry @Phoenox, this slipped through my notifications. Looks great, thanks a ton for the fix!
…20 (#432) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [TestableIO.System.IO.Abstractions](https://github.com/TestableIO/System.IO.Abstractions) | `19.2.87` -> `20.0.1` | [![age](https://developer.mend.io/api/mc/badges/age/nuget/TestableIO.System.IO.Abstractions/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/TestableIO.System.IO.Abstractions/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/TestableIO.System.IO.Abstractions/19.2.87/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/TestableIO.System.IO.Abstractions/19.2.87/20.0.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>TestableIO/System.IO.Abstractions (TestableIO.System.IO.Abstractions)</summary> ### [`v19.2.91`](https://github.com/TestableIO/System.IO.Abstractions/releases/tag/v19.2.91) ##### What's Changed - chore(deps): update dependency saucecontrol.inheritdoc to v1.4.0 by [@​renovate](https://github.com/renovate) in [https://github.com/TestableIO/System.IO.Abstractions/pull/1057](https://github.com/TestableIO/System.IO.Abstractions/pull/1057) - chore(deps): update dependency moq to v4.20.70 by [@​renovate](https://github.com/renovate) in [https://github.com/TestableIO/System.IO.Abstractions/pull/1059](https://github.com/TestableIO/System.IO.Abstractions/pull/1059) - chore(deps): update actions/setup-dotnet action to v4 by [@​renovate](https://github.com/renovate) in [https://github.com/TestableIO/System.IO.Abstractions/pull/1061](https://github.com/TestableIO/System.IO.Abstractions/pull/1061) - fix: prefix bug in MockDirectory.EnumerateDirectories ([#​815](https://github.com/TestableIO/System.IO.Abstractions/issues/815)) by [@​Phoenox](https://github.com/Phoenox) in [https://github.com/TestableIO/System.IO.Abstractions/pull/1046](https://github.com/TestableIO/System.IO.Abstractions/pull/1046) ##### New Contributors - [@​Phoenox](https://github.com/Phoenox) made their first contribution in [https://github.com/TestableIO/System.IO.Abstractions/pull/1046](https://github.com/TestableIO/System.IO.Abstractions/pull/1046) **Full Changelog**: TestableIO/System.IO.Abstractions@v19.2.87...v19.2.91 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/Testably/Testably.Abstractions). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44MS4zIiwidXBkYXRlZEluVmVyIjoiMzcuODEuMyIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Fixes #815
System.IO.Directory.EnumerateDirectories(path)
guarantees that returned paths are always prefixed with the value provided in thepath
parameter. However,MockDirectory.EnumerateDirectories
always returned absolute paths, leading to an inconsistent behavior (e.g. when using relative paths).We now check returned paths from
MockDirectory.EnumerateDirectories
and provide the proper prefix path.