示例#1
0
 /// <summary>
 /// функция обработки одного аргумента
 /// </summary>
 /// <param name="sender">выполнить действие</param>
 /// <param name="e"></param>
 private void ActionSingle(object sender, EventArgs e)
 {
     try
     {
         double  first      = Convert.ToDouble(textBox1.Text.Replace(".", ","));
         ISingle calculator = FactorySingle.Create(((Button)sender).Name);
         double  answer     = calculator.Action(first);
         textBox3.Text = answer.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Произошла ошибка: " + ex.Message);
     }
 }
        public void CreateCalculatorTest(string name, Type expected)
        {
            ISingle calc = FactorySingle.Create(name);

            Assert.IsInstanceOf(expected, calc);
        }