Ejemplo n.º 1
0
 private void Calculate(object sender, EventArgs e)
 {
     try
     {
         string     firstValue  = textBox1.Text;
         string     secondValue = textBox2.Text;
         double     first       = Convert.ToDouble(firstValue);
         double     second      = Convert.ToDouble(secondValue);
         double     third;
         ICalculate calculate = Calculaterfactory.CreatCalculator(((Button)sender).Name);
         third    = calculate.Calculate(first, second);
         Rez.Text = third.ToString();
     }
     catch (Exception ex)
     {
         MessageBox.Show("произошла ошибка: " + ex.Message);
     }
 }
Ejemplo n.º 2
0
        public void CreatCalculatorTest(string name, Type type)
        {
            ICalculate calculate = Calculaterfactory.CreatCalculator(name);

            Assert.IsInstanceOf(type, calculate);
        }