示例#1
0
        public void Test_ConnectDisconnectWhenRoboDKIsAlreadyRunning()
        {
            var rdk = new RoboDK();

            for (var i = 0; i < 10; i++)
            {
                rdk.Connected().Should().BeFalse();
                rdk.Connect().Should().BeTrue();

                // RoboDK is already running. It is not expected that connect will start a new process
                rdk.Process.Should().BeNull();
                rdk.Connected().Should().BeTrue();

                // Test some properties
                rdk.Version().Should().StartWith("5");
                rdk.ApiVersion.Should().BeGreaterThan(0);
                rdk.RoboDKBuild.Should().BeGreaterThan(0);
                rdk.RoboDKServerPort.Should().BeGreaterThan(0);
                rdk.RoboDKClientPort.Should().BeGreaterThan(0);
                rdk.RoboDKServerIpAddress.Length.Should().BeGreaterThan(0);
                rdk.DefaultSocketTimeoutMilliseconds.Should().BeGreaterThan(1000);

                rdk.Disconnect();
                rdk.Connected().Should().BeFalse();
            }
        }