Example #1
0
        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());
        }
Example #2
0
        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());
        }
Example #3
0
        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);
        }
Example #4
0
        public void TestZeroDataPoints()
        {
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo>());

            Assert.AreEqual(int.MaxValue, collection.GetAverageHigh());
        }