-
-
Notifications
You must be signed in to change notification settings - Fork 798
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
Recursive/Deep Mock setup #597
Comments
@informatorius - Due to the Moq 4 API freeze requested by the project owner in the Moq Gitter chat, I think it'd be better to have this discussion over at moq/moq (the repo where Moq 5 is being developed) if it turns out that you actually want to change the API. A couple of points:
|
My point is to get more easy syntax for create a mock. e.g. for a class to test which takes 2 constructor parameters When I want deep mocks then I need to call it with If this would be more easy or usefull also for others then it could make sense to create such API maybe for moq 5. What do you think about it? |
The question should rather be what others think about it. I personally don't see a big win. I'd prefer a smaller, tighter API. Having several ways to achieve the same thing can easily get confusing for those who are learning the API. Btw. have you looked into var deep = new MockRepository { DefaultValue = DefaultValue.Mock };
new MyClass(deep.Create<Interface1>(), deep.Create<Interface2>()); |
Did not know it. MockRepository could be helpful too. |
@informatorius, can we close this or is there something that you feel hasn't been addressed yet? |
Currently we have:
Would it be nice to have:
var mock = new SimpleMock<Interface>();
var mock = new SimpleMockWithProperties<Interface>();
var mock = new DeepMock<Interface>();
var mock = new DeepMockWithProperties<Interface>();
AND:
Interface instance = Mock.Simple<Interface>();
Interface instance = Mock.SimpleWithProperties<Interface>();
Interface instance = Mock.Deep<Interface>();
Interface instance = Mock.DeepWithProperties<Interface>();
(The Mock.DeepWithProperties<Interface>() would match nSubstitute.For<Interface>() )
The text was updated successfully, but these errors were encountered: