public void Dispose_Initialized_NotThrows()
        {
            var client = new ClientSafe("inproc://test");

            client.Init();
            Assert.DoesNotThrow(
                () => client.Dispose());
        }
        public void Dispose_Initialized_Twice_ThrowsFaultException()
        {
            var client = new ClientSafe("inproc://test");

            client.Init();
            client.Dispose();
            Assert.Throws <FaultException>(
                () => client.Dispose(),
                "Cannot close an uninitialised Msg.");
        }
 public void Template()
 {
     using (var server = new AsyncServer(new Handler()))
     {
         server.Bind("inproc://test");
         var client = new ClientSafe("inproc://test");
         client.Init();
         client.Task.Wait();
         Assert.Throws <ArgumentNullException>(() => client.Dispose());
     }
 }
示例#4
0
 public void AwaitClientTask_MissingEndpoint_ThrowsEndpointNotFoundException()
 {
     using (var client = new ClientSafe("inproc://test"))
         Assert.Throws <EndpointNotFoundException>(
             async() => { client.Init(); await client.Task; });
 }
示例#5
0
 public void AwaitClientTask_InvalidAddress_ThrowsArgumentOutOfRangeException()
 {
     using (var client = new ClientSafe("abc"))
         Assert.Throws <ArgumentOutOfRangeException>(
             async() => { client.Init(); await client.Task; });
 }
示例#6
0
 public void AwaitClientTask_NullAddress_ThrowsNullReferenceException()
 {
     using (var client = new ClientSafe(null))
         Assert.Throws <NullReferenceException>(
             async() => { client.Init(); await client.Task; });
 }
示例#7
0
 public void Init_MissingEndpoint_NotFails()
 {
     using (var client = new ClientSafe("inproc://test"))
         Assert.DoesNotThrow(() => client.Init());
 }
示例#8
0
 public void Init_InvalidAddress_NotFails()
 {
     using (var client = new ClientSafe("abc"))
         Assert.DoesNotThrow(() => client.Init());
 }
示例#9
0
 public void Init_NullAddress_NotFails()
 {
     using (var client = new ClientSafe(null))
         Assert.DoesNotThrow(() => client.Init());
 }