C# 在调用WCF服务的操作中存根响应

C# 在调用WCF服务的操作中存根响应,c#,wcf,unit-testing,lambda,microsoft-fakes,C#,Wcf,Unit Testing,Lambda,Microsoft Fakes,我有一个通过以下操作调用的服务: TheResponseObjectOfTheServiceThatIsCalled response = null; ServiceCaller.ExecuteCall(serviceName, () => client.Call(p => response = p.MethodWhichCreatesTheResponse(ref header, request)),

我有一个通过以下操作调用的服务:

TheResponseObjectOfTheServiceThatIsCalled response = null;

ServiceCaller.ExecuteCall(serviceName, () => client.Call(p => response = 
      p.MethodWhichCreatesTheResponse(ref header, request)),
                                              callInfo);
// Use the response.
(serviceName, action, callInfo) => ...
这里p是生成的接口客户端,它使用一种方法创建响应以返回在表达式外部使用的响应

现在,我想填充此服务以通过Microsoft Fakes返回自定义响应。我可以填充ServiceCaller类:ExecuteCall方法可以返回lambda表达式,如下所示:

TheResponseObjectOfTheServiceThatIsCalled response = null;

ServiceCaller.ExecuteCall(serviceName, () => client.Call(p => response = 
      p.MethodWhichCreatesTheResponse(ref header, request)),
                                              callInfo);
// Use the response.
(serviceName, action, callInfo) => ...
此lambda表达式必须返回void


是否可以使用此操作来设置响应对象?

或者,让测试自身承载服务的测试版本并从中返回数据?