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

Null-Coalescing Around Expectations Property #314

Closed
JasonBock opened this issue May 2, 2024 · 1 comment
Closed

Null-Coalescing Around Expectations Property #314

JasonBock opened this issue May 2, 2024 · 1 comment

Comments

@JasonBock
Copy link
Owner

Describe the solution you'd like
This issue made me wonder....what I could do is ?. when I access the Expectations property within the mock. I'm not thrilled with that idea, as the real issue there is virtual members should not be accessed in constructors. But....the only time the expectations would be null is in the constructor until it's set, so it really shouldn't be called anyway.

Other options would be some way to tell Rocks to not generate mock implementations for indentified virtual members. That's also pretty messy and not very desirable.

One other idea is to do some kind of capture that an expectation was going to happen, but it was null. Then, in the constructor, "run" those expectations. That's potentially a lot of work for very little gain, and again, it's to get around something in code that people shouldn't be doing anyway.

@JasonBock
Copy link
Owner Author

Closing this. I have a "workaround" of sorts, and I'll be documenting it.

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

No branches or pull requests

1 participant