public static void DuplexClientBaseOfT_OverNetTcp_Synchronous_Call() { DuplexClientBase <IWcfDuplexService> duplexService = null; Guid guid = Guid.NewGuid(); try { NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; Assert.True(guid == returnedGuid, string.Format("The sent GUID does not match the returned GUID. Sent '{0}', Received: '{1}'", guid, returnedGuid)); ((ICommunicationObject)duplexService).Close(); } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } }
public static void IOperationBehavior_Methods_AreCalled() { DuplexClientBase <ICustomOperationBehaviorDuplexService> duplexService = null; ICustomOperationBehaviorDuplexService proxy = null; NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <ICustomOperationBehaviorDuplexService>(context, binding, new EndpointAddress(FakeAddress.TcpAddress)); proxy = duplexService.ChannelFactory.CreateChannel(); // Wait to validate until the process has been given a reasonable time to complete. Task[] taskCollection = { MyOperationBehavior.validateMethodTcs.Task, MyOperationBehavior.addBindingParametersMethodTcs.Task, MyOperationBehavior.applyClientBehaviorMethodTcs.Task }; bool waitAll = Task.WaitAll(taskCollection, 250); Assert.True(MyOperationBehavior.errorBuilder.Length == 0, "Test case FAILED with errors: " + MyOperationBehavior.errorBuilder.ToString()); Assert.True(waitAll, "None of the IOperationBehavior methods were called."); ((ICommunicationObject)proxy).Close(); ((ICommunicationObject)duplexService).Close(); }
public static void DuplexClientBaseOfT_OverNetTcp_Synchronous_Call() { DuplexClientBase<IWcfDuplexService> duplexService = null; Guid guid = Guid.NewGuid(); try { NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; Assert.True(guid == returnedGuid, string.Format("The sent GUID does not match the returned GUID. Sent '{0}', Received: '{1}'", guid, returnedGuid)); ((ICommunicationObject)duplexService).Close(); } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } }
public static void CreateDuplexClientBase_Binding_Url_Mismatch_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.HttpAddress); Assert.Throws<ArgumentException>("via", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, binding, endpoint); ((ICommunicationObject)duplexClientBase).Open(); }); }
public static void DuplexClientBase_Aborts_Changes_CommunicationState() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); MyDuplexClientBase <IWcfDuplexService> duplexClientBase = new MyDuplexClientBase <IWcfDuplexService>(context, binding, endpoint); Assert.Equal <CommunicationState>(CommunicationState.Created, duplexClientBase.State); duplexClientBase.Abort(); Assert.Equal <CommunicationState>(CommunicationState.Closed, duplexClientBase.State); }
public static void CreateDuplexClientBase_Binding_Url_Mismatch_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.HttpAddress); Assert.Throws <ArgumentException>("via", () => { MyDuplexClientBase <IWcfDuplexService> duplexClientBase = new MyDuplexClientBase <IWcfDuplexService>(context, binding, endpoint); ((ICommunicationObject)duplexClientBase).Open(); }); }
public static void DuplexClientBase_Aborts_Changes_CommunicationState() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, binding, endpoint); Assert.Equal<CommunicationState>(CommunicationState.Created, duplexClientBase.State); duplexClientBase.Abort(); Assert.Equal<CommunicationState>(CommunicationState.Closed, duplexClientBase.State); }
public static void DuplexClientBase_Ctor_Initializes_State() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address); MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, binding, endpoint); Assert.Equal<EndpointAddress>(endpoint, duplexClientBase.Endpoint.Address); Assert.Equal<CommunicationState>(CommunicationState.Created, duplexClientBase.State); duplexClientBase.Abort(); }
public static void DuplexClientBaseOfT_OverHttp_Call_Throws_InvalidOperation() { #if FULLXUNIT_NOTSUPPORTED bool root_Certificate_Installed = Root_Certificate_Installed(); if (!root_Certificate_Installed) { Console.WriteLine("---- Test SKIPPED --------------"); Console.WriteLine("Attempting to run the test in ToF, a ConditionalFact evaluated as FALSE."); Console.WriteLine("Root_Certificate_Installed evaluated as {0}", root_Certificate_Installed); return; } #endif DuplexClientBase <IWcfDuplexService> duplexService = null; IWcfDuplexService proxy = null; try { // *** SETUP *** \\ BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address)); // *** EXECUTE *** \\ var exception = Assert.Throws <InvalidOperationException>(() => { proxy = duplexService.ChannelFactory.CreateChannel(); }); // *** VALIDATE *** \\ // Can't compare the entire exception message - .NET Native doesn't necessarily output the entire message, just params // "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" Assert.True(exception.Message.Contains("BasicHttpBinding")); Assert.Throws <CommunicationObjectFaultedException>(() => { // You can't gracefully close a Faulted CommunicationObject, so we should make sure it throws here too ((ICommunicationObject)duplexService).Close(); }); // *** CLEANUP *** \\ // proxy will be null here so can't close. // duplexService is closed prior to this as part of an assert to verify an expected exception. } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)proxy, duplexService); } }
public static void DuplexClientBaseOfT_OverHttp_Call_Throws_InvalidOperation() { #if FULLXUNIT_NOTSUPPORTED bool root_Certificate_Installed = Root_Certificate_Installed(); if (!root_Certificate_Installed) { Console.WriteLine("---- Test SKIPPED --------------"); Console.WriteLine("Attempting to run the test in ToF, a ConditionalFact evaluated as FALSE."); Console.WriteLine("Root_Certificate_Installed evaluated as {0}", root_Certificate_Installed); return; } #endif DuplexClientBase<IWcfDuplexService> duplexService = null; IWcfDuplexService proxy = null; try { // *** SETUP *** \\ BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address)); // *** EXECUTE *** \\ var exception = Assert.Throws<InvalidOperationException>(() => { proxy = duplexService.ChannelFactory.CreateChannel(); }); // *** VALIDATE *** \\ // Can't compare the entire exception message - .NET Native doesn't necessarily output the entire message, just params // "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" Assert.True(exception.Message.Contains("BasicHttpBinding")); Assert.Throws<CommunicationObjectFaultedException>(() => { // You can't gracefully close a Faulted CommunicationObject, so we should make sure it throws here too ((ICommunicationObject)duplexService).Close(); }); // *** CLEANUP *** \\ // proxy will be null here so can't close. // duplexService is closed prior to this as part of an assert to verify an expected exception. } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)proxy, duplexService); } }
public static void DuplexClientBaseOfT_OverNetTcp_Call() { DuplexClientBase <IWcfDuplexService> duplexService = null; StringBuilder errorBuilder = new StringBuilder(); Guid guid = Guid.NewGuid(); try { NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; if (guid != returnedGuid) { errorBuilder.AppendLine(String.Format("The sent GUID does not match the returned GUID. Sent: {0} Received: {1}", guid, returnedGuid)); } ((ICommunicationObject)duplexService).Close(); } catch (Exception ex) { errorBuilder.AppendLine(String.Format("Unexpected exception was caught: {0}", ex.ToString())); for (Exception innerException = ex.InnerException; innerException != null; innerException = innerException.InnerException) { errorBuilder.AppendLine(String.Format("Inner exception: {0}", innerException.ToString())); } } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } Assert.True(errorBuilder.Length == 0, string.Format("Test Scenario: DuplexClientBaseOfT_OverNetTcp_Call FAILED with the following errors: {0}", errorBuilder)); }
public static void DuplexClientBaseOfT_OverNetTcp_Call() { DuplexClientBase<IWcfDuplexService> duplexService = null; StringBuilder errorBuilder = new StringBuilder(); Guid guid = Guid.NewGuid(); try { NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; if (guid != returnedGuid) { errorBuilder.AppendLine(String.Format("The sent GUID does not match the returned GUID. Sent: {0} Received: {1}", guid, returnedGuid)); } duplexService.Close(); } catch (Exception ex) { errorBuilder.AppendLine(String.Format("Unexpected exception was caught: {0}", ex.ToString())); for (Exception innerException = ex.InnerException; innerException != null; innerException = innerException.InnerException) { errorBuilder.AppendLine(String.Format("Inner exception: {0}", innerException.ToString())); } } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } Assert.True(errorBuilder.Length == 0, string.Format("Test Scenario: DuplexClientBaseOfT_OverNetTcp_Call FAILED with the following errors: {0}", errorBuilder)); }
public static void TransportUsageAlways_WebSockets_Synchronous_Call() { DuplexClientBase<IWcfDuplexService> duplexService = null; Guid guid = Guid.NewGuid(); try { NetHttpBinding binding = new NetHttpBinding(); binding.WebSocketSettings.TransportUsage = WebSocketTransportUsage.Always; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); var uri = new Uri(Endpoints.HttpBaseAddress_NetHttpWebSocket); UriBuilder builder = new UriBuilder(Endpoints.HttpBaseAddress_NetHttpWebSocket); switch (uri.Scheme.ToLowerInvariant()) { case "http": builder.Scheme = "ws"; break; case "https": builder.Scheme = "wss"; break; } duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(builder.Uri)); IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); // Ping on another thread. proxy.Ping(guid); //Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; Assert.True(guid == returnedGuid, string.Format("The sent GUID does not match the returned GUID. Sent '{0}', Received: '{1}'", guid, returnedGuid)); ((ICommunicationObject)duplexService).Close(); } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } }
public static void DuplexClientBaseOfT_OverHttp_Call_Throws_InvalidOperation() { DuplexClientBase <IWcfDuplexService> duplexService = null; IWcfDuplexService proxy = null; try { // *** SETUP *** \\ BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address)); // *** EXECUTE *** \\ var exception = Assert.Throws <InvalidOperationException>(() => { proxy = duplexService.ChannelFactory.CreateChannel(); }); // *** VALIDATE *** \\ // Can't compare the entire exception message - .NET Native doesn't necessarily output the entire message, just params // "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" Assert.Contains("BasicHttpBinding", exception.Message); Assert.Throws <CommunicationObjectFaultedException>(() => { // You can't gracefully close a Faulted CommunicationObject, so we should make sure it throws here too ((ICommunicationObject)duplexService).Close(); }); // *** CLEANUP *** \\ // proxy will be null here so can't close. // duplexService is closed prior to this as part of an assert to verify an expected exception. } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)proxy, duplexService); } }
public static void DuplexClientBaseOfT_OverNetTcp_Synchronous_Call() { DuplexClientBase <IWcfDuplexService> duplexService = null; IWcfDuplexService proxy = null; Guid guid = Guid.NewGuid(); try { // *** SETUP *** \\ NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); proxy = duplexService.ChannelFactory.CreateChannel(); // *** EXECUTE *** \\ // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; // *** VALIDATE *** \\ Assert.True(guid == returnedGuid, string.Format("The sent GUID does not match the returned GUID. Sent '{0}', Received: '{1}'", guid, returnedGuid)); // *** CLEANUP *** \\ ((ICommunicationObject)duplexService).Close(); ((ICommunicationObject)proxy).Close(); } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)proxy, (ICommunicationObject)duplexService); } }
public static void DuplexClientBaseOfT_OverHttp_Call_Throws_InvalidOperation() { DuplexClientBase <IWcfDuplexService> duplexService = null; Guid guid = Guid.NewGuid(); try { BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase <IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address)); var exception = Assert.Throws <InvalidOperationException>(() => { IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); }); // Can't compare the entire exception message - .NET Native doesn't necessarily output the entire message, just params // "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" Assert.True(exception.Message.Contains("BasicHttpBinding")); Assert.Throws <CommunicationObjectFaultedException>(() => { // You can't gracefully close a Faulted CommunicationObject, so we should make sure it throws here too ((ICommunicationObject)duplexService).Close(); }); } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } }
public static void DuplexClientBaseOfT_OverNetTcp_Synchronous_Call() { DuplexClientBase<IWcfDuplexService> duplexService = null; IWcfDuplexService proxy = null; Guid guid = Guid.NewGuid(); try { // *** SETUP *** \\ NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Callback_Address)); proxy = duplexService.ChannelFactory.CreateChannel(); // *** EXECUTE *** \\ // Ping on another thread. Task.Run(() => proxy.Ping(guid)); Guid returnedGuid = callbackService.CallbackGuid; // *** VALIDATE *** \\ Assert.True(guid == returnedGuid, string.Format("The sent GUID does not match the returned GUID. Sent '{0}', Received: '{1}'", guid, returnedGuid)); // *** CLEANUP *** \\ ((ICommunicationObject)duplexService).Close(); ((ICommunicationObject)proxy).Close(); } finally { // *** ENSURE CLEANUP *** \\ ScenarioTestHelpers.CloseCommunicationObjects((ICommunicationObject)proxy, (ICommunicationObject)duplexService); } }
public static void DuplexClientBaseOfT_OverHttp_Call_Throws_InvalidOperation() { DuplexClientBase<IWcfDuplexService> duplexService = null; Guid guid = Guid.NewGuid(); try { BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None); WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<IWcfDuplexService>(context, binding, new EndpointAddress(Endpoints.Https_DefaultBinding_Address)); var exception = Assert.Throws<InvalidOperationException>(() => { IWcfDuplexService proxy = duplexService.ChannelFactory.CreateChannel(); }); // Can't compare the entire exception message - .NET Native doesn't necessarily output the entire message, just params // "Contract requires Duplex, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it" Assert.True(exception.Message.Contains("BasicHttpBinding")); Assert.Throws<CommunicationObjectFaultedException>(() => { // You can't gracefully close a Faulted CommunicationObject, so we should make sure it throws here too ((ICommunicationObject)duplexService).Close(); }); } finally { if (duplexService != null && duplexService.State != CommunicationState.Closed) { duplexService.Abort(); } } }
public static void IOperationBehavior_Methods_AreCalled() { DuplexClientBase<ICustomOperationBehaviorDuplexService> duplexService = null; ICustomOperationBehaviorDuplexService proxy = null; NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.None; WcfDuplexServiceCallback callbackService = new WcfDuplexServiceCallback(); InstanceContext context = new InstanceContext(callbackService); duplexService = new MyDuplexClientBase<ICustomOperationBehaviorDuplexService>(context, binding, new EndpointAddress(FakeAddress.TcpAddress)); proxy = duplexService.ChannelFactory.CreateChannel(); // Wait to validate until the process has been given a reasonable time to complete. Task[] taskCollection = { MyOperationBehavior.validateMethodTcs.Task, MyOperationBehavior.addBindingParametersMethodTcs.Task, MyOperationBehavior.applyClientBehaviorMethodTcs.Task }; bool waitAll = Task.WaitAll(taskCollection, 250); Assert.True(MyOperationBehavior.errorBuilder.Length == 0, "Test case FAILED with errors: " + MyOperationBehavior.errorBuilder.ToString()); Assert.True(waitAll, "None of the IOperationBehavior methods were called."); ((ICommunicationObject)proxy).Close(); ((ICommunicationObject)duplexService).Close(); }
public static void CreateDuplexClientBase_NullEndpoint_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); Assert.Throws<ArgumentNullException>("remoteAddress", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, binding, null); }); }
public static void CreateDuplexClientBase_NullBinding_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); Assert.Throws<ArgumentNullException>("binding", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(context, null, endpoint); }); }
public static void CreateDuplexClientBase_NullContext_Throws() { Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); Assert.Throws<ArgumentNullException>("callbackInstance", () => { MyDuplexClientBase<IWcfDuplexService> duplexClientBase = new MyDuplexClientBase<IWcfDuplexService>(null, binding, endpoint); }); }
public static void CreateDuplexClientBase_NullEndpoint_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); Binding binding = new NetTcpBinding(); Assert.Throws <ArgumentNullException>("remoteAddress", () => { MyDuplexClientBase <IWcfDuplexService> duplexClientBase = new MyDuplexClientBase <IWcfDuplexService>(context, binding, null); }); }
public static void CreateDuplexClientBase_NullBinding_Throws() { InstanceContext context = new InstanceContext(new WcfDuplexServiceCallback()); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); Assert.Throws <ArgumentNullException>("binding", () => { MyDuplexClientBase <IWcfDuplexService> duplexClientBase = new MyDuplexClientBase <IWcfDuplexService>(context, null, endpoint); }); }
public static void CreateDuplexClientBase_NullContext_Throws() { Binding binding = new NetTcpBinding(); EndpointAddress endpoint = new EndpointAddress(FakeAddress.TcpAddress); Assert.Throws <ArgumentNullException>("callbackInstance", () => { MyDuplexClientBase <IWcfDuplexService> duplexClientBase = new MyDuplexClientBase <IWcfDuplexService>(null, binding, endpoint); }); }