示例#1
0
        public void FirstTest(double value, double expected)
        {
            ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Cube");
            double result = calculator.Calculate(value);

            Assert.AreEqual(expected, result, 0.01);
        }
示例#2
0
 private void ClickUnary(object sender, EventArgs e)
 {
     try
     {
         string firstValueText            = textBox1.Text;
         double firstValue                = Convert.ToDouble(firstValueText);
         string buttonName                = ((Button)sender).Name;
         ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator(buttonName);
         double result = calculator.Calculate(firstValue);
         textBox3.Text = result.ToString();
     }
     catch
     {
         textBox3.Text = "Ошибка";
     }
 }
示例#3
0
        public void DivisionExeptionTest()
        {
            ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Log");

            Assert.Throws <Exception>(() => calculator.Calculate(0));
        }
示例#4
0
        public void ArccosExceptionTest()
        {
            ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Arccos");

            Assert.Throws <Exception>(() => calculator.Calculate(2));
        }