public void TestOneDataPoint() { var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> { new WeatherInfo(DateTime.Today.AddDays(-3), 50, 40) }); Assert.AreEqual(50.0, collection.GetAverageHigh()); }
public void TestTwoDataPoints() { var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> { new WeatherInfo(DateTime.Today.AddDays(-3), 0, -10), new WeatherInfo(DateTime.Today, 100, 90) }); Assert.AreEqual(50, collection.GetAverageHigh()); }
public void TestManyDataPointsDecimalAnswer() { var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> { new WeatherInfo(DateTime.Today.AddDays(-3), -2, -10), new WeatherInfo(DateTime.Today.AddDays(-2), 32, -10), new WeatherInfo(DateTime.Today, 118, 90) }); Assert.AreEqual(49.33, collection.GetAverageHigh(), .009); }
public void TestZeroDataPoints() { var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo>()); Assert.AreEqual(int.MaxValue, collection.GetAverageHigh()); }