public void wcf_proxy_refreshes_faulted_channel_before_invoking() { // Arrange Func <object> createChannel = () => ChannelFactory <IHelloWorldService> .CreateChannel(new NetTcpBinding(), new EndpointAddress(uri)); var factory = new WcfProxyFactory(); var proxy = factory.Create <IDisposableHelloWorldService>(createChannel); // Act try { proxy.ThrowException(); } catch { } // Assert var accessor = proxy as IProxyTargetAccessor; var manager = accessor.DynProxyGetTarget() as IWcfChannelManager; Assert.Equal(CommunicationState.Faulted, manager.Channel.State); Assert.DoesNotThrow(delegate { proxy.HelloWorld(); }); }
public void wcf_proxy_disposes_faulted_channel_without_throwing() { // Arrange Func <object> createChannel = () => ChannelFactory <IHelloWorldService> .CreateChannel(new NetTcpBinding(), new EndpointAddress(uri)); var factory = new WcfProxyFactory(); var proxy = factory.Create <IDisposableHelloWorldService>(createChannel); // Act try { proxy.ThrowException(); } catch { } // Assert Assert.DoesNotThrow(delegate { proxy.Dispose(); }); }
public void wcf_proxy_fowards_calls_to_wcf_channel() { // Arrange Func <object> createChannel = () => ChannelFactory <IHelloWorldService> .CreateChannel(new NetTcpBinding(), new EndpointAddress(uri)); var factory = new WcfProxyFactory(); var proxy = factory.Create <IDisposableHelloWorldService>(createChannel); // Act var result = proxy.HelloWorld(); // Assert Assert.Equal("Hello World!", result); }
public void wcf_proxy_does_not_throw_communication_object_faulted_exception_when_faulted_channel_disposed() { // Arrange Func <object> createChannel = () => ChannelFactory <IHelloWorldService> .CreateChannel(new NetTcpBinding(), new EndpointAddress(uri)); var factory = new WcfProxyFactory(); var proxy = factory.Create <IDisposableHelloWorldService>(createChannel); Assert.Throws <FaultException>(delegate { using (proxy) { proxy.ThrowException(); } }); }