Actually what I wanted is something like this
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
var IServiceInterface = Isolate.Fake.Instance<IService>();
//This is where I am confused. This is what I want to write
IServiceInterface.IncludeInterface<IChannel>();
var fakeChannelFactory = Isolate.Fake.Instance<ChannelFactory<IService>>().Returns(IServiceInterface);
}
}
then somewhere in my code, we find
public class GenerateProxyFor<TServiceToCreate>
private IChannel _openChannel
public TServiceToCreate CreateService( )
{
var serviceProxy = _factory.Create();
_openChannel = serviceProxy as IChannel;
return serviceProxy;
}
public void Dispose()
{
_openChannel.Close();
//Errorhandling and stuff, so I want to be able to mock out _openChannel.State == CommunicationState.Faulted etc.
}
Let me know if you have any further questions