Exemplo n.º 1
0
        public ActionResult Calculate(double firstValue, double lastValue, string operation)
        {
            var    calc        = TwoArgumentsFatory.CreateCalculator(operation);
            double resultValue = calc.Calculate(firstValue, lastValue);

            return(View(resultValue));
        }
Exemplo n.º 2
0
 private void Calculate_Click(object sender, EventArgs e)
 {
     try
     {
         double firstValue  = Convert.ToDouble(textBox1.Text);
         double lastValue   = Convert.ToDouble(textBox2.Text);
         var    calc        = TwoArgumentsFatory.CreateCalculator(((Button)sender).Name);
         double resultValue = calc.Calculate(firstValue, lastValue);
         textBox3.Text = resultValue.ToString();
     }
     catch (Exception exception)
     {
         MessageBox.Show("Возникла ошибка: " + exception.Message);
     }
 }
        public void CalculateTest(string name, Type type)
        {
            var calculator = TwoArgumentsFatory.CreateCalculator(name);

            Assert.IsInstanceOf(type, calculator);
        }