示例#1
0
 public void Test_IsConnected_Variation_4()
 {
     using var server = new TestServer(ServiceName);
     server.Register();
     using var client = new DdeClient(ServiceName, TopicName);
     var listener = new EventListener();
     client.Disconnected += listener.OnEvent;
     client.Connect();
     server.Disconnect();
     Assert.IsTrue(listener.Received.WaitOne(Timeout, false));
     Assert.IsFalse(client.IsConnected);
 }
示例#2
0
 public void Test_Disconnected_Variation_2()
 {
     using var server = new TestServer(ServiceName);
     server.Register();
     using var client = new DdeClient(ServiceName, TopicName);
     var listener = new EventListener();
     client.Disconnected += listener.OnEvent;
     client.Connect();
     server.Disconnect();
     Assert.IsTrue(listener.Received.WaitOne(Timeout, false));
     var args = (DdeDisconnectedEventArgs) listener.Events[0];
     Assert.IsTrue(args.IsServerInitiated);
     Assert.IsFalse(args.IsDisposed);
 }
示例#3
0
 public void Test_IsConnected_Variation_4()
 {
     using (TestServer server = new TestServer(ServiceName))
     {
         server.Register();
         using (DdeClient client = new DdeClient(ServiceName, TopicName))
         {
             EventListener listener = new EventListener();
             client.Disconnected += listener.OnEvent;
             client.Connect();
             server.Disconnect();
             Assert.IsTrue(listener.Received.WaitOne(Timeout, false));
             Assert.IsFalse(client.IsConnected);
         }
     }
 }
示例#4
0
 public void Test_Disconnected_Variation_2()
 {
     using (TestServer server = new TestServer(ServiceName))
     {
         server.Register();
         using (DdeClient client = new DdeClient(ServiceName, TopicName))
         {
             EventListener listener = new EventListener();
             client.Disconnected += listener.OnEvent;
             client.Connect();
             server.Disconnect();
             Assert.IsTrue(listener.Received.WaitOne(Timeout, false));
             DdeDisconnectedEventArgs args = (DdeDisconnectedEventArgs)listener.Events[0];
             Assert.IsTrue(args.IsServerInitiated);
             Assert.IsFalse(args.IsDisposed);
         }
     }
 }