public void CalculateTest() { ExpCalculator calculator = new ExpCalculator(); Assert.AreEqual(148.413159102577, calculator.Calculate(5)); Assert.AreEqual(1, calculator.Calculate(0)); }
public void CalculateTest(double firstValue, double expected) { var calculator = new ExpCalculator(); var actualResult = calculator.Calculate(firstValue); Assert.AreEqual(expected, actualResult, 0.01); }
public void CalculateTest(double firstArgument, double expectedAnswer) { var calculator = new ExpCalculator(); var actualResult = calculator.Calculate(firstArgument); Assert.AreEqual(expectedAnswer, actualResult, 0.001); }
void CalcTests(double testnum) { ExpCalculator expc = new ExpCalculator(); double expResult = Math.Exp(testnum), actResult = expc.Calculate(testnum); Assert.AreEqual(expResult, actResult); }
/// <summary> /// 内存比较 /// </summary> /// <param name="obj"></param> /// <returns></returns> public bool IsMatch(object obj) { foreach (var item in _expression) { if (item is Operand) { ((Operand)item).Bind(obj); } } return(ExpCalculator.Calculate(_expression)); }