public void NonIntegerSubtraction() { Assert.AreEqual(-9.8M, decimal.Parse(MathFunctionObj.Subtract("0.1", "9.9"))); Assert.AreEqual(80.46M, decimal.Parse(MathFunctionObj.Subtract("45.23", "-35.23"))); Assert.AreEqual(5.2M, decimal.Parse(MathFunctionObj.Subtract("0", "-5.2"))); Assert.AreEqual(5.2M, decimal.Parse(MathFunctionObj.Subtract(" 0", " -5.2"))); }
public void BadInput() { Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract("text", "10")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract("10", "text")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract("", "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract(null, "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract("", null)); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Subtract(null, null)); }
public void IntegerSubtraction() { Assert.AreEqual(0.0M, decimal.Parse(MathFunctionObj.Subtract("5", "5"))); Assert.AreEqual(-8M, decimal.Parse(MathFunctionObj.Subtract("1", "9"))); Assert.AreEqual(-50M, decimal.Parse(MathFunctionObj.Subtract("-20", "30"))); Assert.AreEqual(-10M, decimal.Parse(MathFunctionObj.Subtract("0", "10"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Subtract("10", "0"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Subtract("10 ", " 0"))); }