Comments (3)
Fixed with #1013
from system.io.abstractions.
@rcdailey : Maybe you want to consider checking out Testably.Abstractions.Testing. I created an alternative mock file system that uses the same interface as System.IO.Abstractions, so it is compatible with your production code.
This issue is not present there, as the file system per default does not initialize anything, unless you explicitly tell it to.
Due to an extensive test suite that runs both against the mocked and against the real file system, it is much closer to the real file system also in edge cases.
from system.io.abstractions.
That's a good catch and something we did not anticipate in #372 and #590.
I would rather not change this behavior back because it seems to work for most users :)
I'd tend towards a new constructor with options like you suggested. Something like this:
public class MockFileSystemOptions
{
string CurrentDirectory { get; init; } = ""
bool CreateDefaultTempDir { get; init } = true
}
public MockFileSystem(IDictionary<string, MockFileData> files, MockFileSystemOptions options)
Happy to discuss further in a PR :)
from system.io.abstractions.
Related Issues (20)
- Async options for all actions HOT 1
- IFile.Open(Read) cannot be mocked with NSubstitute anymore due to System.IO.Abstractions.FileSystemStream HOT 8
- MockFileSystem: IFile.GetLastWriteTimeUtc may return wrong last write time after calling IFileInfo.Open HOT 2
- BinaryFormatter becomes obsolete -> Remove it with .NET 8.0 HOT 2
- MockPath.GetFullPath does not match windows behavior. HOT 4
- IDirectoryInfoFactory.Wrap loses part of absolute path when used with MockFileSystem HOT 4
- PathVerifier fails on whitespace filename under Linux and .NET Core HOT 1
- Creating new MockFileInfo thinks file exists when it actually does not. HOT 3
- Microsoft Fakes does not generate Fakes namespace for System.IO.Abstractions interfaces HOT 1
- I want to step out of this project HOT 13
- Providing mocks as and when necessary HOT 4
- Allow selection of os dependent FS semantics HOT 3
- Clearning the `Directory` flag causes a directory to be turned into a regular file HOT 1
- `FlushAsync` doesn't update file contents HOT 3
- FileStreamWrapper breaks patternmatching type testing HOT 5
- MockFileSystem.Directory.CreateDirectory should throw IOException if conflicting file exists HOT 2
- Signature missing in the dll HOT 8
- FileInfoFactory and DirectoryInfoFactory Wrap implementations don't match the interface for nullability HOT 2
- IFileSystemInfo.ResolveLinkTarget throws exception instead of returning null if the path is not a link HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from system.io.abstractions.