-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow transitive dependencies 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. * Suggested change to clean up CA warnings (#87) * Cleanup expression * Handle recursive object graph (error) * Apply suggestions from code review Co-authored-by: Kevin B <Keboo@users.noreply.github.com> * Remaining PR feedback. Standardize test objects as public rather than suppressing errors Co-authored-by: Kevin B <Keboo@users.noreply.github.com> Co-authored-by: Adam Hewitt <adamhewitt627@users.noreply.github.com> Co-authored-by: Adam Hewitt <adamhewitt@outlook.com>
- Loading branch information
1 parent
a09cfb5
commit c052088
Showing
15 changed files
with
252 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Moq.AutoMock.Tests.Util | ||
{ | ||
public class HasClassDependency | ||
{ | ||
public WithService WithService { get; } | ||
|
||
public HasClassDependency(WithService withService) | ||
{ | ||
WithService = withService; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
|
||
namespace Moq.AutoMock.Tests.Util | ||
{ | ||
public class HasFuncDependencies | ||
{ | ||
public Func<WithService> WithServiceFactory { get; } | ||
|
||
public HasFuncDependencies(Func<WithService> withServiceFactory) | ||
{ | ||
WithServiceFactory = withServiceFactory; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Moq.AutoMock.Tests.Util | ||
{ | ||
public class With2ClassDependencies | ||
{ | ||
public WithService WithService { get; } | ||
public With3Parameters With3Parameters { get; } | ||
|
||
public With2ClassDependencies(WithService withService, With3Parameters with3Parameters) | ||
{ | ||
WithService = withService; | ||
With3Parameters = with3Parameters; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Moq.AutoMock.Tests.Util | ||
{ | ||
public class WithRecursiveDependency | ||
{ | ||
public WithRecursiveDependency Child { get; } | ||
|
||
public WithRecursiveDependency(WithRecursiveDependency child) | ||
{ | ||
Child = child; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.