public void OverallTest() { // Setup const double Epsilon = 0.000000000001; const double Error1 = 1.234; const double Error2 = -1.234; const double Error3 = 9.756; const double Expected1 = Error1; double expected2 = Math.Pow((Math.Pow(Error1, 2) + Math.Pow(Error2, 2) + Math.Pow(Error3, 2)) / 3, 0.5); var target = new RmsCalculator(); // Execute target.AddToErrorCalc(new[] { Error1 }); var actual1 = target.Calculate(); target.AddToErrorCalc(new[] { Error2, Error3 }); var actual2 = target.Calculate(); target.Reset(); target.AddToErrorCalc(new[] { Error3 }); var actual3 = target.Calculate(); // Verify Assert.AreEqual(Expected1, actual1, Epsilon); Assert.AreEqual(expected2, actual2, Epsilon); Assert.AreEqual(Error3, actual3); }
public void Calculate_ProtectsAgainstDivideByZero() { var target = new RmsCalculator(); target.Calculate(); }