Пример #1
0
        public void TestOneDataPoint()
        {
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                new WeatherInfo(DateTime.Today.AddDays(-3), 50, 40)
            });

            Assert.AreEqual(40, collection.GetAverageLow());
        }
Пример #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(40, collection.GetAverageLow());
        }
Пример #3
0
        public void TestManyDataPointsDecimalAnswer()
        {
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                new WeatherInfo(DateTime.Today.AddDays(-3), 5, 2),
                new WeatherInfo(DateTime.Today, 100, 97),
                new WeatherInfo(DateTime.Today, 100, 43)
            });

            Assert.AreEqual(47.33, collection.GetAverageLow(), .009);
        }
Пример #4
0
        public void TestZeroDataPoints()
        {
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo>());

            Assert.AreEqual(double.MinValue, collection.GetAverageLow());
        }