Giter Club home page Giter Club logo

Comments (4)

vbreuss avatar vbreuss commented on June 9, 2024

I am not sure, I understand your use case, @sameera.

Do you use a mocking library like Moq or NSubstitute? If so, it should be easy to not use MockFileSystem at all and simply mock the IFileSystem or IFile interface itself.
Mixing the In-Memory Filesystem with a mock doesn't make sense to me, as you could then run in the situation that you write to a file via the mock and when you later read it from the In-Memory file system, you will get a FileNotFoundException.

from system.io.abstractions.

sameera avatar sameera commented on June 9, 2024

At a very high-level, the use case was to test that certain file operations are not being done over and over. So, we'd want our unit test to test that certain file system APIs (like File.ReadAllText) are not being called more than once. There are other file system operations along this execution path, so we don't want to have to replace all of them with mock code.
BTW, while I'm not yet fully familiar with this concept or library, it might be that Typemock's Isolators are a solution for this.

from system.io.abstractions.

vbreuss avatar vbreuss commented on June 9, 2024

The idea behind an In-Memory file system is, that it should behave (more or less) exactly like a real file system. If we would allow replacing single calls, this would result in much more complexity, as we could no longer rely on any consistent behavior. For this I would not like to introduce any (backward-incompatible) changes in the interface.

That being said, if I understand your use case correctly, you would like some "analytical" information about which method is called how often. This could be an interesting extension to the current MockFileSystem. If you would like to work on such a feature, I would be happy to discuss more details...

from system.io.abstractions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.