Beispiel #1
0
 /// <summary>
 /// Эта часть кода отвечает за функции с одним операндом.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void rnd_Click1(object sender, EventArgs e)
 {
     try
     {
         IOneArgument cal1    = FactoryOneArgument.CreateCalculator(((Button)sender).Name);
         double       currnum = Convert.ToDouble(textBox1.Text);
         double       endres  = cal1.Calculate(currnum);
         label1.Text = Convert.ToString(endres);
     }
     catch (Exception exc)
     {
         label1.Text = exc.Message;
     }
 }
        public void CalculateTest(string name, Type type)
        {
            var calculator = FactoryOneArgument.CreateCalculator(name);

            Assert.IsInstanceOf(type, calculator);
        }