Пример #1
0
        public void TestNoDaysInCollection()
        {
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo>
            {
            });

            Assert.ThrowsException <InvalidOperationException>(() => collection.FindLowestHighTemps());
        }
Пример #2
0
        public void TestOneDaysInMonth()
        {
            var testWeatherInfo = new WeatherInfo(DateTime.Parse("1/2/2007"), 0, -10);
            var collection      = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testWeatherInfo
            });
            var result   = collection.FindLowestHighTemps();
            var expected = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testWeatherInfo
            });

            Assert.IsTrue(expected.SequenceEqual(result));
        }
Пример #3
0
        public void TestTwoDaysInMonthHighBoundry()
        {
            var testinfo1S = new WeatherInfo(DateTime.Parse("1/2/2007"), -1, -10);
            var testinfo2  = new WeatherInfo(DateTime.Parse("1/2/2007"), 0, -10);
            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testinfo1S,
                testinfo2
            });
            var expected = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testinfo1S
            });
            var result = collection.FindLowestHighTemps();

            Assert.IsTrue(expected.SequenceEqual(result));
        }
Пример #4
0
        public void TestManyDaysInMonthTempertureSequenceLastIsLowest()
        {
            var testinfo1  = new WeatherInfo(DateTime.Parse("1/2/2007"), 1, -10);
            var testinfo2  = new WeatherInfo(DateTime.Parse("1/2/2007"), 0, -10);
            var testinfo3S = new WeatherInfo(DateTime.Parse("1/2/2007"), -1, -10);

            var collection = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testinfo1,
                testinfo2,
                testinfo3S
            });
            var expected = new WeatherInfoCollection("Test1", new List <WeatherInfo> {
                testinfo3S
            });
            var result = collection.FindLowestHighTemps();

            Assert.IsTrue(expected.SequenceEqual(result));
        }