public void TestDivison() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); Assert.AreEqual(calc.Calculate(4.4m, 2.2m, Calculator.models.CalculationType.DIVISTION), 2.0m); try { Assert.AreEqual(calc.Calculate(4.4m, 0.0m, Calculator.models.CalculationType.DIVISTION), 2.0m); Assert.Fail(); } catch (DivideByZeroException ex) { Assert.IsTrue(true); } }
public void TestAddition() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); decimal result = calc.Calculate(2.5m, 4m, Calculator.models.CalculationType.ADDITION); Assert.Equal(6.5m, result); }
public void TestDivision() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); decimal result = calc.Calculate(2.5m, 4m, Calculator.models.CalculationType.DIVISTION); Assert.Equal(0.625m, result); }
public void TestMultiplication() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); decimal result = calc.Calculate(2.5m, 4m, Calculator.models.CalculationType.MULTIPLICATION); Assert.Equal(10.0m, result); }
public void TestSubtraction() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); decimal result = calc.Calculate(2.5m, 4m, Calculator.models.CalculationType.SUBTRACTION); Assert.Equal(-1.5m, result); }
public void TestDivision() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); Assert.Throws <DivideByZeroException>(() => { decimal result = calc.Calculate(6.0m, 0.0m, Calculator.models.CalculationType.DIVISTION); Assert.IsType <decimal>(result); }); }
public void TestDivisionZero() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); decimal result = calc.Calculate(2.5m, 0m, Calculator.models.CalculationType.DIVISTION); }
public void TestAddition() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); Assert.AreEqual(calc.Calculate(2.2m, 1.1m, Calculator.models.CalculationType.ADDITION), 3.3m); Assert.AreEqual(calc.Calculate(2.2m, -1.1m, Calculator.models.CalculationType.ADDITION), 1.1m); }
public void TestMultiplication() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); Assert.AreEqual(calc.Calculate(2.0m, 2.0m, Calculator.models.CalculationType.MULTIPLICATION), 4.0m); }
public void TestSubtraction() { Calculator.models.Calculator calc = new Calculator.models.Calculator(); Assert.AreEqual(calc.Calculate(2.2m, 1.1m, Calculator.models.CalculationType.SUBTRACTION), 1.1m); Assert.AreEqual(calc.Calculate(2.2m, -1.1m, Calculator.models.CalculationType.SUBTRACTION), 3.3m); }