Esempio n. 1
0
        public void GetWeatherData_WithValidData_Returns_PopulatedList()
        {
            //act
            var result = TextDataParser.GetWeatherData() as List <WeatherDataRecord>;

            //assert
            Assert.AreNotEqual(0, result.Count);
        }
        private static IEnumerable <WeatherDataRecord> LoadData()
        {
            var dataParser = new TextFileWeatherDataParser(@"C:\Users\SoftwareDevelopment\source\repos\CSharpCodeClinic\WeatherDataTests\TestFiles")
            {
                FromDate = new DateTime(2013, 01, 01),
                ToDate   = new DateTime(2013, 01, 9)
            };

            return(dataParser.GetWeatherData());
        }
Esempio n. 3
0
        public void GetWeatherData_InvalidDirectory_Returns_EmptyList()
        {
            //arrange
            var parser = new TextFileWeatherDataParser("NoSuchPath");

            //act
            var result = parser.GetWeatherData() as List <WeatherDataRecord>;

            //assert
            Assert.AreEqual(0, result.Count);
        }
Esempio n. 4
0
        public void GetWeatherData_WithEmptyDataDirectory_Returns_EmptyList()
        {
            //arrange
            var dir    = Directory.CreateDirectory("Test");
            var parser = new TextFileWeatherDataParser(dir.FullName);

            //act
            var result = parser.GetWeatherData() as List <WeatherDataRecord>;

            //assert
            Assert.AreEqual(0, result.Count);

            //cleanup
            dir.Delete();
        }