I have a class similar to the following:
public class MyProxy : ClientBase<IService>, IService
{
public MyProxy(String endpointConfiguration) :
base(endpointConfiguration) { }
public int DoSomething(int x)
{
int result = DoSomethingToX(x);
int result2 = ((IService)this).DoWork(x)
int result3 = result2 ...
return result3;
}
int IService.DoWork(int x)
{
return base.Channel.DoWork(x);
}
}
The problem is that when testing, I don’t know how to mock the result2 element without extracting the part that gets result3 using result2 into a separate method. And, since this is unit testing, I don’t want to go deeper to check which result2 is returned ... I would rather mock the data somehow ..., could call a function and replace it with one call.
source
share