public void BadInput() { Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add("text", "10")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add("10", "text")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add("", "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add(null, "")); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add("", null)); Assert.AreEqual(Project1.Functions.MathFunctions.ErrorMessage, MathFunctionObj.Add(null, null)); }
public void IntegerAddition() { Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("5", "5"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("1", "9"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("-20", "30"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("0", "10"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("10", "0"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add(" 10 ", " 0 "))); }
public void NonIntegerAddition() { Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("0.1", "9.9"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add("45.23", "-35.23"))); Assert.AreEqual(10M, decimal.Parse(MathFunctionObj.Add(" 45.23", "-35.23 "))); }