예제 #1
0
 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;
     }
 }
예제 #2
0
        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);
        }