private void Single_Click(object sender, EventArgs e) { try { string argumentString = textBoxFirstIn.Text; double argument = Convert.ToDouble(argumentString); ISingleArgumentCalculatorcs singlecalculator = SingleArgumentFactory.CreateSingleCalculate(((Button)sender).Name); double result = singlecalculator.SingleCalculate(argument); textBoxOut.Text = result.ToString(); } catch (Exception single) { textBoxOut.Text = single.Message; } }
public void CalculateTest() { ISingleArgumentCalculatorcs singlecalculator = SingleArgumentFactory.CreateSingleCalculate("root"); Assert.Throws <Exception>(() => singlecalculator.SingleCalculate(2)); }
public void SingleCalculateTest(string name, Type type) { var calculator = SingleArgumentFactory.CreateSingleCalculate(name); Assert.IsInstanceOf(type, calculator); }