public void CosinusTest1() { ISingleOperation calc = SingleOperationFactory.Create("cos"); double result = calc.Calculation(3.14); Assert.AreEqual(result, Math.Cos(3.14)); }
public void SwapTest1() { ISingleOperation calc = SingleOperationFactory.Create("+/-"); double result = calc.Calculation(5); Assert.AreEqual(result, (-5)); }
public void LgTest2() { ISingleOperation calc = SingleOperationFactory.Create("lg"); double result = calc.Calculation(5); Assert.AreEqual(result, Math.Log10(5)); }
public void SinusTest2() { ISingleOperation calc = SingleOperationFactory.Create("sin"); double result = calc.Calculation(1); Assert.AreEqual(result, Math.Sin(1)); }
public void ArctgTest2() { ISingleOperation calc = SingleOperationFactory.Create("arctg"); double result = calc.Calculation(3); Assert.AreEqual(Math.Atan(3), result); }
public void SqrtTest2() { ISingleOperation calc = SingleOperationFactory.Create("sqrt"); double result = calc.Calculation(9); Assert.AreEqual(result, 3); }
public void ArccosTest2() { ISingleOperation calc = SingleOperationFactory.Create("arccos"); double result = calc.Calculation(0.3); Assert.AreEqual(result, Math.Acos(0.3)); }
public void CosTest2() { ISingleOperation calc = SingleOperationFactory.Create("cos"); double result = calc.Calculation(Math.PI); Assert.AreEqual(result, (-1)); }
public void LnTest1() { ISingleOperation calc = SingleOperationFactory.Create("ln"); double result = calc.Calculation(1); Assert.AreEqual(result, 0); }
public void LnTest2() { ISingleOperation calc = SingleOperationFactory.Create("ln"); double result = calc.Calculation(Math.Pow(Math.E, 2)); Assert.AreEqual(2, result); }
public void ArcsinTest1() { ISingleOperation calc = SingleOperationFactory.Create("arcsin"); double result = calc.Calculation(1); Assert.AreEqual(result, Math.Asin(1)); }
public void FactorialTest1() { ISingleOperation calc = SingleOperationFactory.Create("n!"); double result = calc.Calculation(5); Assert.AreEqual(result, 120); }
public void CtgTest1() { ISingleOperation calc = SingleOperationFactory.Create("ctg"); double result = calc.Calculation(2); Assert.AreEqual(result, 1 / Math.Tan(2)); }
public void SquareTest1() { ISingleOperation calc = SingleOperationFactory.Create("x^2"); double result = calc.Calculation(2); Assert.AreEqual(result, 4); }
public void DelxTest2() { ISingleOperation calc = SingleOperationFactory.Create("1/x"); double result = calc.Calculation(5); Assert.AreEqual(0.2, result); }
public void delxTest1() { ISingleOperation calc = SingleOperationFactory.Create("1/x"); double result = calc.Calculation(2); Assert.AreEqual(result, 0.5); }
public void FactorialTest2() { ISingleOperation calc = SingleOperationFactory.Create("n!"); double result = calc.Calculation(7); Assert.AreEqual(5040, result); }
public void CubedTest1() { ISingleOperation calc = SingleOperationFactory.Create("x^3"); double result = calc.Calculation(2); Assert.AreEqual(result, 8); }
public void ArcctgTest2() { ISingleOperation calc = SingleOperationFactory.Create("arcctg"); double result = calc.Calculation(2); Assert.AreEqual(result, Math.PI / 2 - Math.Atan(2)); }
private void SimpleCalculate(object sender, EventArgs e) { double doubleFirstArgument = Convert.ToDouble(firstArgument.Text); try { ISingleOperation calculator = SingleOperationFactory.Create(((Button)sender).Text); if (firstArgument.Text != "") { resultField.Text = calculator.Calculation(doubleFirstArgument).ToString(); } } catch (Exception exception) { resultField.Text = exception.Message; } }
public void ArccosFailTest() { ISingleOperation calc = SingleOperationFactory.Create("arccos"); double result = calc.Calculation(-2); }
public void DelxTest3() { ISingleOperation calc = SingleOperationFactory.Create("1/x"); double result = calc.Calculation(0); }
public void LnTest3() { ISingleOperation calc = SingleOperationFactory.Create("ln"); double result = calc.Calculation(-2); }