Exemple #1
0
        public void ListenAccept中に停止()
        {
            using (var server = new AwaitingServer()) {
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                server.StartNetwork(9999);
                Thread.Sleep(100);

                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(true, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                server.StopNetwork();

                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);
            }
        }
Exemple #2
0
        public void StopControl後に停止()
        {
            using (var server = new AwaitingServer()) {
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                server.StartNetwork(9999);
                Thread.Sleep(100);
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(true, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                using (var client = new TcpClient()) {
                    client.Connect(IPAddress.Loopback, 9999);
                    Thread.Sleep(100);
                    Assert.AreEqual(false, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(true, server.IsNetworkConnected);

                    server.StartControl("D2XX0");
                    CheckIo(client.GetStream());
                    Assert.AreEqual(true, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(true, server.IsNetworkConnected);

                    server.StopControl();
                    Assert.AreEqual(false, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(true, server.IsNetworkConnected);

                    server.StopNetwork();

                    Assert.AreEqual(false, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(false, server.IsNetworkConnected);
                }
            }
        }
Exemple #3
0
        public void 何も始まってないのに停止()
        {
            using (var server = new AwaitingServer()) {
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                server.StopNetwork();
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);
            }
        }
Exemple #4
0
        public void データ待ち中に停止()
        {
            using (var server = new AwaitingServer()) {
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(false, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                server.StartNetwork(9999);
                Thread.Sleep(100);
                Assert.AreEqual(false, server.IsConnected);
                Assert.AreEqual(true, server.IsListening);
                Assert.AreEqual(false, server.IsNetworkConnected);

                using (var client = new TcpClient()) {
                    client.Connect(IPAddress.Loopback, 9999);
                    Thread.Sleep(100);
                    Assert.AreEqual(false, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(true, server.IsNetworkConnected);

                    server.StopNetwork();

                    Assert.AreEqual(false, server.IsConnected);
                    Assert.AreEqual(false, server.IsListening);
                    Assert.AreEqual(false, server.IsNetworkConnected);
                }
            }
        }