public void CalculateAverageWithoutData_ShouldBeZero() { ConsumptionCalculator calculator = new ConsumptionCalculator(); calculator.CalculateAverage(); Assert.AreEqual(0.0f, calculator.Average); }
public void CalculateAverageWithOneData_ShouldBeCorrect() { ConsumptionCalculator calculator = new ConsumptionCalculator(); calculator.Add(120.5f, 9.8f); calculator.CalculateAverage(); Assert.AreEqual(8.13f, calculator.Average); }
public void CalculateAverageWithManyData_ShouldBeCorrect() { ConsumptionCalculator calculator = new ConsumptionCalculator(); for (int i = 1; i < 1000; i++) { calculator.Add(120.5f * i, 9.8f * i); } calculator.CalculateAverage(); Assert.AreEqual(8.13f, calculator.Average); }