Exemplo n.º 1
0
        public void SinTest()
        {
            ICalculatorOneArgument calculator = CalculatorOneFactory.CreateCalculator("Sin");
            double result = calculator.Calculator(1);

            Assert.AreEqual(0.8414709848, result, 0.00001);
        }
Exemplo n.º 2
0
        public void CosTest()
        {
            ICalculatorOneArgument calculator = CalculatorOneFactory.CreateCalculator("Cos");
            double result = calculator.Calculator(1);

            Assert.AreEqual(0.54030, result, 0.00001);
        }
Exemplo n.º 3
0
        public void SquareTest()
        {
            ICalculatorOneArgument calculator = CalculatorOneFactory.CreateCalculator("Square");
            double result = calculator.Calculator(5);

            Assert.AreEqual(25, result);
        }
Exemplo n.º 4
0
 private void Square_Click(object sender, EventArgs e)
 {
     try
     {
         double firstnum      = Convert.ToDouble(textBox4.Text);
         string caluclateName = ((Button)sender).Name;
         ICalculatorOneArgument calculator1 = CalculatorOneFactory.CreateCalculator(caluclateName);
         double result = calculator1.Calculator(firstnum);
         textBox6.Text = result.ToString();
     }
     catch (Exception OneArgumentException)
     {
         MessageBox.Show("Неверное выражение" + OneArgumentException);
     }
 }
Exemplo n.º 5
0
        public void log10exeptiontest()
        {
            ICalculatorOneArgument calculator = CalculatorOneFactory.CreateCalculator("Log10");

            Assert.Throws <Exception>(() => calculator.Calculator(-187));
        }
Exemplo n.º 6
0
        public void sqrtexeptiontest()
        {
            ICalculatorOneArgument calculator = CalculatorOneFactory.CreateCalculator("Sqrt");

            Assert.Throws <Exception>(() => calculator.Calculator(-79));
        }