-
-
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 2nd property not mocked #438
Comments
@dosfx, thanks for reporting! You're not missing anything. This is a bug. I'm surprised that noone's run into this before. Until this bug is fixed, you're better off not using resultMock.SetupGet(result => result.Part1).Returns(Mock.Of<ISubResult>());
resultMock.SetupGet(result => result.Part2).Returns(Mock.Of<ISubResult>()); Some background:
(For better understanding why that behaviour is there at all, consider the below example where it indeed prevents public interface IPing { IPong Pong { get; } }
public interface IPong { IPing Ping { get; } }
var pingMock = new Mock<IPing>();
pingMock.SetupAllProperties(); The loop detection logic could be fixed by making it also consider recursion depth along with the property types. |
@dosfx, this will be fixed in the next release of Moq (version >4.7.99). |
Thank you very much! Thats great :)
…On Sat, Sep 16, 2017 at 7:32 PM, stakx ***@***.***> wrote:
@dosfx <https://github.com/dosfx>, this will be fixed in the next release
of Moq (version >4.7.99).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#438 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AH_MXg6zKx-w_9WUI7oUPPZbPceJOx2lks5sjFp7gaJpZM4PNZ4K>
.
|
New to moq, so its probably me but I've got an interface that I'm mocking with 2 get properties of another interface. When I call SetupAllProperties on the mock, the 2nd get property doesn't appear to get mocked. All I can think is that it is due to it being the same type?
example:
Currently my workaround is to call
resultMock.SetupAllProperties();
and then callresultMock.SetupProperty(m => m.Part1.Name);
but I feel like I must be missing somethingThanks for reading
The text was updated successfully, but these errors were encountered: