I am trying to run this example and use a padding to remove an external dependency on a WCF service call that is being called from a method; I do unit test on. Unlike the example, I generate my WCF client on the fly using code similar to this:
ChannelFactory<IReportBroker> factory = new ChannelFactory<IReportBroker>("ReportBrokerBasicHttpStreamed", new EndpointAddress(this.CurrentSecurityZoneConfigurationManager.ConfigurationSettings[Constants.ConfigurationKeys.ReportBrokerServiceUrl])); IReportBroker proxy = factory.CreateChannel(); proxy.Execute(requestMessage))
How can I adapt this example to lay the proxy returned by the CreateChannel method? I assume that in the ShimWCFService class I need to add something like ....
ShimChannelFactory<TService>.AllInstances.CreateChannel = (var1) => { return [instance of a mock object]};
However, I'm not sure how to associate the layout of the <TService> object with this pad as a return value.
source share