public void Test_ConvertDate() { List <string> inputDateList = new List <string> { "02/27/17", "June 2, 2018", "Jul-13-2016", "April 31, 2018", // This is an invalid date - Date does not exist "December 1, 2018" }; // Expected dates in the format "yyyy-MM-dd" i.e. 2020 - 12 - 01 List <string> expectedDateList = new List <string> { "2017-02-27", "2018-06-02", "2016-07-13", null, // This is an invalid date - Date does not exist "2018-12-01" }; List <string> outputDateList = new List <string>(); string outputDateString; using (NASA_Driver driver = new NASA_Driver(_dataFilePath, _apiService, _fileService)) { foreach (string dateString in inputDateList) { outputDateString = driver.ConvertDateString(dateString); outputDateList.Add(outputDateString); } } Assert.AreEqual(JsonConvert.SerializeObject(expectedDateList), JsonConvert.SerializeObject(outputDateList)); }
public async Task Test_NASA_Driver() { using (NASA_Driver driver = new NASA_Driver(_dataFilePath, _apiService, _fileService)) { await driver.DownLoadNASAPhotos(); } }
/// <summary> /// This method drives the NASA file download process /// </summary> /// <param name="args"></param> public static void Main(string[] args) { //CreateWebHostBuilder(args).Build().Run(); string dataFilePath = _dataFilePath; _apiService = new NASA_API_Service(_uri, _apiKey); _fileService = new NASA_FileService(); // Down NASA photos using (NASA_Driver driver = new NASA_Driver(_dataFilePath, _apiService, _fileService)) { driver.DownLoadNASAPhotos() .ConfigureAwait(false) .GetAwaiter() .GetResult(); } }