Skip to content

FileSystemWatcher has no setter in MockFileSystem #1329

Closed

Description

@Dave-Senn

In #409 a setter was added to MockFileSystem.FileSystemWatcher. The current version of MockFileSystem does not have a setter for FileSystemWatcher. Is this done intentionally, or is it a regression?
In case the property should not have a setter, how should tests be written for classes that get IFileSystem injected and use it to create a file watcher?

Activity

  1. vbreuss commented on Aug 19, 2025

    @vbreuss
    Member

    The setter was removed in #782 and it seems on purpose:

    The setter for MockFileSystem.FileSystemWatcher has been removed. It is now virtual and should be overriden if required.

    So you would have to create a custom MyMockFileSystem that inherits from MockFileSystem and overrides the FileSystemWatcher.

    Alternatively you could also try to use Testably.Abstractions, which has a fully working mocked FileSystemWatcher.

  2. Dave-Senn commented on Sep 3, 2025

    @Dave-Senn
    Author

    @vbreuss Thanks for your answer. For me everything is clear and the question/issue can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions