user3173788
user3173788

Reputation: 21

How to mock an interface implementing ChannelFactory

This is the method i used to call my wcf service method(GetCountry) through interface IService1.Which implement channel factory

public IList<Country> GetCountry()
{
   ChannelFactory<ServiceLibrary.IService1> channelFactory = new               ChannelFactory<IService1>(binding, address);

   IService1 channel1 = channelFactory.CreateChannel();

   var response= channel1.GetCountry();

   return response;
}

How to mock the service call using NUNIT?

Upvotes: 2

Views: 876

Answers (1)

Pradeep Sahoo
Pradeep Sahoo

Reputation: 35

you cant mock directly . Use any mocking framework and Isolate the service call and get the result of service by some dummy values Isolate.whencalled.willReturn(serviceValue)

Upvotes: 1

Related Questions