Mocking DuplexchannelFactory
<pre><code>I'm trying to test a class which uses duplexchannelfactory.
I thought to mock duplexchannelfactory and make expectation over it.    
</code></pre>

<p>here is my code,</p>

<pre><code> NetTcpBinding bind = mocks.Stub&lt;NetTcpBinding&gt;();
 callback = mocks.Stub&lt;ServiceCallback&gt;();// class tat implementts callback
</code></pre>

<p>EndpointAddress add = mocks.Stub("net.tcp://161.85.103.209:8001/ComicAgent/SimulatorService/TCPReceiver");</p>

<p><strong>channelFactory =  new DuplexChannelFactory(callback,bind,add);</strong>
// this is working(but i don't need this)</p>

<p>channelFactory =  mocks.stub>(callback,bind,add);// this is not working..</p>

<p>The inclusion of above line shows error like:</p>

<p>atComicAgentCommunication.ComicAgentProxyTest (TestFixtureSetUp):
SetUp : System.Exception : Exception in constructor: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.ServiceModel.ChannelFactory.EnsureSecurityCredentialsManager(ServiceEndpoint endpoint)
   at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
   at System.ServiceModel.DuplexChannelFactory<code>1..ctor(Object callbackObject)
   at DuplexChannelFactory</code>1Proxyc76b772a467e46689a819fde9e0c0179..ctor(IInterceptor[] , Object )
  ----> System.NullReferenceException : Object reference not set to an instance of an object.</p>

<p>I dono whether i'm doig correctly. can any one say wat's wrong??
Thanks..</p>
