Skip to content
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

Add possibility to verify which methods were called #476

Closed
vbreuss opened this issue Mar 10, 2024 · 2 comments · Fixed by #545
Closed

Add possibility to verify which methods were called #476

vbreuss opened this issue Mar 10, 2024 · 2 comments · Fixed by #545
Labels
enhancement New feature or request state: released

Comments

@vbreuss
Copy link
Member

vbreuss commented Mar 10, 2024

Inspired by TestableIO/System.IO.Abstractions#1081:
Add an option to verify which methods were called on the MockFileSystem. This should cover the following use cases:

  • Determine if a method was called with specific parameters
  • Determine if a method was called before another method
  • Determine how often a method was called

Idea:

  • Add a Statistics property on the MockFileSystem. All external calls get registered there.
  • This property should expose a list of called methods, each with the name of the method and its parameters.
  • The calls should contain a global incremented "sort order" to determine the order in which the methods were called.

We could then write extension methods (e.g. in https://github.com/Testably/Testably.Abstractions.FluentAssertions) to verify the above scenarios.

@vbreuss vbreuss added the enhancement New feature or request label Mar 10, 2024
@vbreuss
Copy link
Member Author

vbreuss commented Mar 10, 2024

It would also be interesting to have statistics for property access (e.g. when a getter or setter was used)

vbreuss added a commit that referenced this issue Mar 10, 2024
From #476 
Add a `Statistics` property to the `MockFileSystem` so that it is
possible to check which method calls were made on it.
vbreuss added a commit that referenced this issue Mar 15, 2024
From #476 
After implementing basic statistics for methods in #474, also support
statistics for property access.

---------

Co-authored-by: Valentin <valentin.breuss@baur.at>
Copy link

github-actions bot commented Apr 1, 2024

This is addressed in release v3.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request state: released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant