-
-
Notifications
You must be signed in to change notification settings - Fork 802
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
SetupAllProperties with DefaultValue.Mock throws on concrete property type without parameterless constructor #149
Comments
dougbu
added a commit
to aspnet/AspNetWebStack
that referenced
this issue
Aug 25, 2016
- work around devlooped/moq#129 and devlooped/moq#212; Moq creates proxies for all `interface` methods - e.g. set up `IDisposable.Dispose()` calls - related bug devlooped/moq#212 means we can't use `MockBehavior.Strict` in some cases - especially when method returns a value and therefore can't be set up to call base - `CallBase = true` is often required in these cases - work around devlooped/moq#149; `DefaultValue.Mock` restrictions - where necessary, explicitly set up members instead - work around odd failures in `JsonResultTest` using `SetupSet()` on deep properties - use `MockBehavior.Strict` in `NullContentIsNotOutput()` to confirm `Write()` is not called - handle less-predictable proxy type names
dougbu
added a commit
to aspnet/AspNetWebStack
that referenced
this issue
Aug 26, 2016
- #11 (3 of 4) - work around devlooped/moq#129 and devlooped/moq#212; Moq creates proxies for all `interface` methods - e.g. set up `IDisposable.Dispose()` calls - related bug devlooped/moq#212 means we can't use `MockBehavior.Strict` in some cases - especially when method returns a value and therefore can't be set up to call base - `CallBase = true` is often required in these cases - work around devlooped/moq#149; `DefaultValue.Mock` restrictions - where necessary, explicitly set members up instead - work around odd failures in `JsonResultTest` using `SetupSet()` on deep properties - use `MockBehavior.Strict` in `NullContentIsNotOutput()` to confirm `Write()` is not called - handle less-predictable proxy type names
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to reproduce:
Mock
of an interface with a writeable property, where the property type is a concrete type without a parameterless constructor.DefaultValue
toDefaultValue.Mock
SetupAllProperties
Here's an example:
Expected outcome
The mock's behaviour should now have 'property behaviour', and no exception should have been thrown.
Actual outcome
The call to
SetupAllProperties
throws an exception. Here's the exception thrown by the above example:If you comment out the line that sets
DefaultValue
toDefaultValue.Mock
, not exception is thrown.The text was updated successfully, but these errors were encountered: