public void WillApplyChannelFactoryAwareExtensionsWhenChannelRefreshed()
{
windsorContainer.Register(
Component.For<ChannelFactoryListener>(),
Component.For<IOperationsEx>()
.Named("operations")
.AsWcfClient(new DefaultClientModel()
{
Endpoint = WcfEndpoint
.BoundTo(new NetTcpBinding { PortSharingEnabled = true })
.At("net.tcp://localhost/Operations/Ex")
})
);
CollectionAssert.IsEmpty(ChannelFactoryListener.ChannelsRefreshed);
var client = windsorContainer.Resolve<IOperationsEx>("operations");
try
{
client.ThrowException();
Assert.Fail("Should have raised an exception");
}
catch (Exception)
{
CollectionAssert.IsEmpty(ChannelFactoryListener.ChannelsRefreshed);
client.Backup(new Dictionary<string, object>());
}
Assert.AreEqual(1, ChannelFactoryListener.ChannelsRefreshed.Count);
CollectionAssert.AreEqual(new[] { client }, ChannelFactoryListener.ChannelsAvailable);
}