/// <summary> /// the event handler for the button with two arguments /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TwoArgument(object sender, EventArgs e) { try { var nameButton = ((Button)sender).Name; var calculator = FactoryTwoArgument.CreatCalculator(nameButton); var firstArgument = Convert.ToDouble(FirstValue.Text.Trim()); var secondArgument = Convert.ToDouble(SecondValue.Text.Trim()); Result.Text = calculator.Calculate(firstArgument, secondArgument).ToString(); } catch (Exception exc) { MessageBox.Show(exc.Message); } }
public void OneArgumentTest(string name, Type type) { var calculator = FactoryTwoArgument.CreatCalculator(name); Assert.AreEqual(type, calculator.GetType()); }