public void MathPlugin_CommandTimeout()
        {
            TcpAppClient newClient = new TcpAppClient("127.0.0.1", 25000);

            newClient.Connect();
            TcpAppCommandResult result = newClient.ExecuteCommand("CreatePlugin simplemath M2");

            Assert.AreEqual(TcpAppCommandStatus.OK, result.Status);
            Assert.Throws <TcpAppClientException>(() => { newClient.ExecuteCommand("M2 TimeoutSim"); });
        }
Exemplo n.º 2
0
 private void SendCommand()
 {
     try
     {
         string command = string.Empty;
         if (!string.IsNullOrEmpty(CommandBox.Text))
         {
             if (!CommandBox.Items.Contains(CommandBox.Text))
             {
                 CommandBox.Items.Add(CommandBox.Text);
             }
             command = CommandBox.Text;
             if (ChkCRLF.Checked)
             {
                 command += "\r\n";
             }
         }
         if (ptrClient == AppClient)
         {
             AppClient.ExecuteCommand(command, Convert.ToInt32(TxtTimeout.Text));
         }
         else
         {
             TcpClient.Write(command);
             AppendOutput(command, Color.FromArgb(224, 224, 224));
         }
     }
     catch (Exception ex)
     {
         AppendOutput("ERROR: " + ex.Message + "\r\n", Color.Red);
     }
 }
Exemplo n.º 3
0
        private void SendCommand()
        {
            try
            {
                string command = string.Empty;
                if (CbFunctions.SelectedIndex != 0)
                {
                    command = CbFunctions.SelectedItem.ToString();
                }

                if (!string.IsNullOrEmpty(CommandBox.Text))
                {
                    if (!CommandBox.Items.Contains(CommandBox.Text))
                    {
                        CommandBox.Items.Add(CommandBox.Text);
                    }
                    command += " " + CommandBox.Text;
                }
                Client.ExecuteCommand(command.Trim());
            }
            catch (Exception ex)
            {
                AppendOutput("ERROR: " + ex.Message + "\r\n", Color.Red);
            }
        }
Exemplo n.º 4
0
        public void Client3Execution()
        {
            TcpAppClient client = new TcpAppClient("localhost", 25000);

            client.Connect();
            for (int x = 0; x < 10; x++)
            {
                if (client.ExecuteCommand("Delay C3 80").Status == TcpAppCommandStatus.ERR)
                {
                    TestContext.Progress.WriteLine("C3 Terminated on Error!");
                    Assert.Fail();
                    break;
                }
            }
            while (!C3ThreadAbort)
            {
                client.ExecuteCommand("CheckStatus"); Thread.Sleep(5000);
            }
        }
Exemplo n.º 5
0
 private void ExecuteCommand(string cmd)
 {
     try
     {
         TcpAppCommandResult result = appClient.ExecuteCommand(cmd);
         if (result.Status == TcpAppCommandStatus.ERR)
         {
             throw new Exception("ERROR: Execution FAILED! " + result.ReturnMessage);
         }
     }
     catch (Exception ex) { HandleException(ex); }
 }
Exemplo n.º 6
0
 private TcpAppCommandResult ExecuteCommand(string command)
 {
     return(Client.ExecuteCommand(command));
 }
        public void MathPluginSum()
        {
            TcpAppCommandResult result = Client.ExecuteCommand("CreatePlugin simplemath M1");

            Assert.AreEqual(TcpAppCommandStatus.OK, result.Status);
            result = Client.ExecuteCommand("M1 Sum 10 20 30 45");
            Assert.AreEqual("105", result.ReturnMessage);
        }
Exemplo n.º 8
0
 public void ExecuteSystemCommand_NotSignedIn()
 {
     Client.Connect();
     CheckResult(Client.ExecuteCommand("Help"));
 }
Exemplo n.º 9
0
        public void CreateInstance()
        {
            TcpAppCommandResult result = Client.ExecuteCommand("CreateObject SamplePlugin MyPlugin1");

            Assert.AreEqual(TcpAppCommandStatus.OK, result.Status);
            Assert.NotNull(Server.PluginList.FirstOrDefault(x => x.Alias == "MyPlugin1"));
        }