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; } }
public void CalculateTest(string name, Type type) { var calculator = OneArgumentsCalculatorFactory.CreateCalculator(name); Assert.IsInstanceOf(type, calculator); }