Let's say I have a class like the following:
public class Test{
private RemoteDoc.Documentation docService = new RemoteDoc.Documentation();
public Test(){}
}
So this makes it difficult to unit test because there is a dependency on the proxy class. You can pass in the object via the constructor like so:
public class Test{
private RemoteDoc.Documentation docService;
public Test(RemoteDoc.Documentation serv)
{
docService = serv;
}
}
Now in my unit tests I can instantiate the Test class and pass in a mocked object into the constructor. However, this solution isn't ideal because now other classes have to know about RemoteDoc.Documentation proxy class and have explicit references to it. What's is a good solution to this problem?
EDIT: To be more clear, RemoteDoc.Documentation is a proxy class for a web reference. Think of it like if you were using salesforce.com's api and all you really have is the wsdl and disco files.