Exemplo n.º 1
0
 public void OneArgumentButtonClick(object sender, EventArgs e)
 {
     try
     {
         Button clickedButton = (Button)sender;
         double number        = Convert.ToDouble(Number1Field.Text);
         IOneArgumentCalculator calculator = OneArgumentsCalculatorFactory.CreateCalculator(clickedButton.Text);
         double result = calculator.Calculate(number);
         ResultField.Text = result.ToString();
     }
     catch (Exception exc)
     {
         ResultField.Text = exc.Message;
     }
 }
Exemplo n.º 2
0
        public void CalculateTest(string name, Type type)
        {
            var calculator = OneArgumentsCalculatorFactory.CreateCalculator(name);

            Assert.IsInstanceOf(type, calculator);
        }