-
Notifications
You must be signed in to change notification settings - Fork 266
Description
Problem:
I have a parser that iterates through the file system and parses each file one by one. The functionality is built around IEnumerables and needs to ensure that the next file is read for parsing only after all downstream functions are done processing the previous one.
To test for this, I want to setup a mock for File.ReadAllText and ensure that it's not being called until again the previous file is done.
I could do this by setting up a mock for IFile and checking calls to ReadAllText as that's the only op I do on IFile type. I do have few other calls to other file system objects that I don't want to mock/change. If MockFileSystem.File was settable, I can assign the mock for this test only without changing anything about the other tests.
Proposed solution:
Provide setters for MockFileSystem.File and MockFileSystem.Directory (for consistency and possible similar use cases).
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Alternatives:
For such tests, setup a mocked IFileSystem from scratch with all objects and methods mocked. This could be tedious in many cases.