示例#1
0
 /// <summary>
 /// Handles click event for run button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnexecute_Click(object sender, EventArgs e)
 {
     if (textBox1.Text != null && !textBox1.Equals(""))
     {
         CommandValidations cmdval = new CommandValidations(textBox1);
         if (!cmdval.IsCommandInvalid)
         {
             try
             {
                 Command c = new Command();
                 c.loadCommand(textBox1, g, panel1);
             }
             catch (Exception exc)
             {
                 txtErrorOutput.Text += "\r\n" + exc.ToString();
             }
         }
         else if (!cmdval.IsSyntaxValid)
         {
             txtErrorOutput.Text += "\r\n Command Not Found.";
         }
         else if (!cmdval.IsParameterValid)
         {
             txtErrorOutput.Text += "\r\n Paramter error.";
         }
         else
         {
             txtErrorOutput.Text += "\r\n Command Errors. Click Help for checking commands and syntax.";
         }
     }
     else
     {
         txtErrorOutput.Text += (" Command Field Is Empty !!!!!");
     }
 }
示例#2
0
        public void SyntaxValidationTest()
        {
            TextBox tb = new TextBox();

            tb.Text = "asdf";
            bool expected = false;

            Graphical_PL_Application.CommandValidations cmdval = new Graphical_PL_Application.CommandValidations(tb);
            cmdval.CheckCmdLineValidation(tb.Text);

            bool actual = cmdval.IsSyntaxValid;

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void CommandValidationtest()
        {
            //arrange
            TextBox tb = new TextBox();

            tb.Text = "moveto 100,100";
            bool expected = true;

            //act
            Graphical_PL_Application.CommandValidations cmdval = new Graphical_PL_Application.CommandValidations(tb);
            cmdval.CheckCmdLineValidation(tb.Text);
            //assert
            bool actual = cmdval.IsCmdValid;

            Assert.AreEqual(expected, actual);
        }