You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be useful if I could configure a mock to throw an exception when any member is accessed, without having to first declare a specific member via .Setup() in order to configure .Throws()
Similar to the feature Mock.SetupReturnsDefault() provides for specifying a return value without first specifying a member via .Setup()
For example: mockDependency.SetupThrowsDefault<Exception>();
or mockDependency.SetupThrowsDefault(new Exception());
If this sounds like a good idea, I'd be willing to fork and try it.
The text was updated successfully, but these errors were encountered:
Yes. That does the trick. I forgot about Strict. Thanks @kzu !
Is it possible to change the mock's behavior after instantiation? I see the property is read-only.
Yes. That does the trick. I forgot about Strict. Thanks @kzu https://github.com/kzu !
Is it possible to change the mock's behavior after instantiation? I see
the property is read-only.
—
You are receiving this because you were mentioned.
It would be useful if I could configure a mock to throw an exception when any member is accessed, without having to first declare a specific member via .Setup() in order to configure .Throws()
Similar to the feature Mock.SetupReturnsDefault() provides for specifying a return value without first specifying a member via .Setup()
For example:
mockDependency.SetupThrowsDefault<Exception>();
or
mockDependency.SetupThrowsDefault(new Exception());
If this sounds like a good idea, I'd be willing to fork and try it.
The text was updated successfully, but these errors were encountered: