我如何测试一个利用网络服务参考资料产生的代理客户的班子?
我愿对客户进行模拟,但所生成的客户界面没有包含近距离方法,必须妥善终止代理。 如果我不使用接口,而是具体提及,那么我就能够接触近距离方法,但无法篡改代理。
I m 试图测试一个类似类别:
public class ServiceAdapter : IServiceAdapter, IDisposable
{
// ILoggingServiceClient is generated via a Web Service reference
private readonly ILoggingServiceClient _loggingServiceClient;
public ServiceAdapter() : this(new LoggingServiceClient()) {}
internal ServiceAdapter(ILoggingServiceClient loggingServiceClient)
{
_loggingServiceClient = loggingServiceClient;
}
public void LogSomething(string msg)
{
_loggingServiceClient.LogSomething(msg);
}
public void Dispose()
{
// this doesn t compile, because ILoggingServiceClient doesn t contain Close(),
// yet Close is required to properly terminate the WCF client
_loggingServiceClient.Close();
}
}