示例#1
0
 private void btnAddProgram_Click(object sender, EventArgs e)
 {
     try
     {
         Verifiers.VerifyName(txbFood.Text);
         if (Verifiers.VerifyProgram(txbFood.Text))
         {
             throw new CustomExceptions("Programa já existente.");
         }
         Verifiers.VerifyTimer(txbTimer.Text);
         int  timer     = int.Parse(txbTimer.Text);
         int  power     = Verifiers.VerifyPower(txbPower.Text);
         char character = Verifiers.VerifyChar(txbChar.Text);
         DefaultPrograms.AddCustomProgram(txbFood.Text, txbInstruction.Text, character, power, timer);
         ReadPrograms();
     }
     catch (CustomExceptions errorMessage)
     {
         MessageBox.Show(errorMessage.Message);
     }
     catch (FormatException errorMessage)
     {
         MessageBox.Show(errorMessage.Message);
     }
 }
示例#2
0
        public void ListContains()
        {
            DefaultPrograms.WritePrograms();
            DefaultPrograms obj = DefaultPrograms.programsList[0];

            string text = obj.ProgramName;

            Assert.IsTrue(Verifiers.VerifyProgram(text));
        }