如何使用ClientBase模拟Web服务

时间:2014-10-17 12:15:13

标签: c# web-services mocking

我是使用以下接口和继承实现的Web服务的客户:

public partial class FixLinkReportingServiceClient : System.ServiceModel.ClientBase<STPTradeRetriever.FixLinkReportingService.IFixLinkReportingService>, STPTradeRetriever.FixLinkReportingService.IFixLinkReportingService 
{
    ....
}

我应该如何模拟对象,特别是ClientBase部分?

如果我尝试执行以下操作:

public class FakeSuccessConnection : ClientBase<STPTradeRetriever.FixLinkReportingService.IFixLinkReportingService>,
        STPTradeRetriever.FixLinkReportingService.IFixLinkReportingService
{
}

它会抱怨app.config中缺少端点:

Could not find default endpoint element that references contract 'FixLinkReportingService.IFixLinkReportingService' 
in the ServiceModel client configuration section. 
This might be because no configuration file was found for your application, or 
because no endpoint element matching this contract could be found in the client element.

0 个答案:

没有答案