예제 #1
0
        private static LoadData LoadAllData()
        {
            //create an instance of the loaddata class and download all the data
            LoadData loader = new LoadData();

            loader.DownloadPopulation();
            loader.DownloadCovid(MyFileChoice.CurrentDeaths);
            //loader.DownloadCovid(MyFileChoice.CurrentConfirmedCases);
            loader.DownloadPopulation();
            return(loader);
        }
예제 #2
0
        public void TestDownloadCovid_GetCurrentDate(MyFileChoice source)
        {
            //arrange
            LoadData loader = new LoadData();

            //act
            loader.DownloadCovid(source);
            DateTime lastLoggedDate = loader.dates.Last();
            DateTime todayDate      = DateTime.Now;

            Debug.WriteLine(lastLoggedDate);
            Debug.WriteLine(todayDate);

            TimeSpan date_span = (todayDate - lastLoggedDate).Duration();

            // Assert
            //return true if the last logged day is the current day +/- 2 days
            bool result = date_span.Days < 2 ? true : false;

            Assert.IsTrue(result, "the date differs by more than 2 days");
        }