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

Consider Making Expectations to be Disposable #224

Open
JasonBock opened this issue Mar 30, 2023 · 5 comments
Open

Consider Making Expectations to be Disposable #224

JasonBock opened this issue Mar 30, 2023 · 5 comments

Comments

@JasonBock
Copy link
Owner

I just make RockRepository implement IDisposable "better", in that once Dispose() is called, you can't call members on it again without getting ObjectDisposedException.

I'm starting to wonder if Expectations<T> should do the same thing. In other words, make Dispose() do what Verify() does, enforce dispose semantics, and then remove Verify().

This would be a pretty big change, because I'm removing a member that used all over the place. But....it feels like this might be a better design. Definitely need to think this one through.

@JasonBock JasonBock added this to the 7.1.0 milestone Mar 30, 2023
@JasonBock JasonBock modified the milestones: 7.1.1, 8.0.0 Jul 3, 2023
@JasonBock
Copy link
Owner Author

I would consider doing this if I go down this road.

@JasonBock JasonBock reopened this Sep 3, 2023
@JasonBock
Copy link
Owner Author

Definitely considering doing this now.

@JasonBock JasonBock removed this from the 7.2.0 milestone Nov 7, 2023
@JasonBock JasonBock changed the title Consider Making Expectations<T> to be Disposable Consider Making Expectations to be Disposable Jan 13, 2024
@JasonBock
Copy link
Owner Author

Since RockRepository was deleted with 8.0.0, it may make sense to revisit this and see if it makes sense. I know when I tried it recently, there were test cases that ended up being a little awkward by doing this, but....worth another shot.

@JasonBock
Copy link
Owner Author

Note: I would put XML docs on Verify() that people should stop calling it, and move to handling the expectations objects as a disposable one. Eventually, I'd obsolete it, but not for the moment. Maybe have to put some defensiveness in both Verify() and Dispose() to not do it twice.

@JasonBock JasonBock modified the milestones: 8.2.0, 9.0.0 Jul 16, 2024
@JasonBock
Copy link
Owner Author

One idea is that Dispose() would only be concerned about any potential clean-up, like for SAMIs. It would not do the Verify() call for you, unless you haven't done it yet.

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

No branches or pull requests

1 participant