public void NonIntegerDivision() { Assert.AreEqual(5M, decimal.Parse(MathFunctionObj.Divide("0.5", "0.1"))); Assert.AreEqual(3.8M, decimal.Parse(MathFunctionObj.Divide("11.4", "3"))); Assert.AreEqual(13.5M, decimal.Parse(MathFunctionObj.Divide("310.5", "23"))); Assert.AreEqual(4.3M, decimal.Parse(MathFunctionObj.Divide("349.16", "81.2"))); }
public void BadInput() { Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide("text", "10")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide("10", "text")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide("", "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide(null, "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide("", null)); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide(null, null)); }
public void DivideByZero() { Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Divide("1.0", "0")); }
public void IntegerDivision() { Assert.AreEqual(1M, decimal.Parse(MathFunctionObj.Divide("5", "5"))); Assert.AreEqual(5M, decimal.Parse(MathFunctionObj.Divide("10", "2"))); Assert.AreEqual(0.5M, decimal.Parse(MathFunctionObj.Divide("5", "10"))); }