public void FirstTest(double value, double expected) { ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Cube"); double result = calculator.Calculate(value); Assert.AreEqual(expected, result, 0.01); }
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 = "Ошибка"; } }
public void DivisionExeptionTest() { ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Log"); Assert.Throws <Exception>(() => calculator.Calculate(0)); }
public void ArccosExceptionTest() { ICalculateOneArgument calculator = CalculateOneFactory.CreateCalculator("Arccos"); Assert.Throws <Exception>(() => calculator.Calculate(2)); }