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
Allow transitive dependencies #86
Conversation
Moq allows passing constructor args to mock instances via `new Mock<Foo>(arg1, arg2, ...)`. This pull request enables doing this for automocker, enhancing the "auto" part of "automocker". Why do this? Because forcing every class to have an interface seems unreasonable. Feel free to subscribe to whatever philosophy you prefer, but the interface-to-class pairing does generate a lot of boilerplate. Just as Moq allows as many scenarios as possible, Moq.Contrib should also.
} | ||
else | ||
{ | ||
#pragma warning disable CA1825 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created #87 as a proposed cleanup instead of disabling this here.
@@ -1,7 +1,7 @@ | |||
namespace Moq.AutoMock.Tests.Util | |||
{ | |||
#pragma warning disable CA1801, CA1812 //is an internal class that is apparently never instantiated | |||
internal class With3Parameters | |||
public class With3Parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a bit of a disjoint here. If this should be public
then we should remove the CA1812 above and update the comment, or this could go back to internal
Hold up on merging this. It doesn't handle recursive dependencies... working on it. |
LGTM so far - what is the version number impact? Thinking particularly of the |
Alright, I handled recursive object graphs by throwing an error. We could probably get more robust in that area, but this is a big start. @adamhewitt627 I believe this doesn't break any behavior. This uses (basically) the public |
Co-authored-by: Kevin B <Keboo@users.noreply.github.com>
Standardize test objects as public rather than suppressing errors
Moq allows passing constructor args to mock instances via
new Mock<Foo>(arg1, arg2, ...)
. This pull request enables doing thisfor automocker, enhancing the "auto" part of "automocker".
Why do this? Because forcing every class to have an interface seems
unreasonable. Feel free to subscribe to whatever philosophy you prefer,
but the interface-to-class pairing does generate a lot of boilerplate.
Just as Moq allows as many scenarios as possible, Moq.Contrib should
also.