public void TestCalculation() { // Setup IEquationCalculation equationCalculation = new EquationCalculation(4, array); //validate Assert.AreEqual(0.279524982f, equationCalculation.GetResult(0, 0)); Assert.AreEqual(0.279525, System.Math.Round(equationCalculation.GetResult(0, 0), 6)); }
public void UsesPointAsDecimalSeperator_ShouldCalculateWithCommas() { var calculator = new CalculatorModel() { UsesPointAsDecimalSeperator = false }; double actualResult = calculator.CalculateFromText("2,6 + 2,5"); Assert.Equal(5.1, actualResult); var expectedCalculation = new EquationCalculation("5,1", "2,6 + 2,5"); EquationCalculation actualCalculation = calculator.Results[0]; Assert.Equal( expectedCalculation.Result, actualCalculation.Result ); Assert.Equal( expectedCalculation.Equation, actualCalculation.Equation ); }