'How to MOQ object in call chain?
Using Moq is there a way to mock an object that exists in the call chain of the system under test?
So in my test:
var x = mock.Create<ISystemUnderTest>();
var result = x.DoSomething();
Then in my system under test:
public Person User => return new Person(){ Name="Smithy" };
public string DoSomething(){
var x = User.Name; // I want to use a mock instance here of User
}
Can I mock User when it's not being provided as a parameter? But just a member of the call chain?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
