public void UpdateDatabaseWithCompanyDetailsTest() { ClearTable(); string[] columnNames = { "NASDAQ Symbol", "Security Name" }; var fileName = @"symboldirectory/otherlisted.txt"; LoadFileToDb lftdb = PrepareCompanyDetailsList(columnNames, ref fileName); columnNames = new string[] { "Symbol", "Sector", "industry", "IPOyear" }; var temppath = Path.GetTempPath(); fileName = @"symboldirectory/NYSECompanyList.csv"; var delimiter = ","; fileName = temppath + fileName; lftdb.FileName = fileName; lftdb.Columns = columnNames; lftdb.Delimiter = delimiter; var loadResult = lftdb.ParseCompanyDetailsFile(); var resultCount = lftdb.SaveRecordsToDb(_repository); Assert.IsTrue(loadResult); var testRcd = _context.CompanyDetails.FirstOrDefault(s => s.Symbol.Equals("ICE")); Assert.AreEqual(2005, testRcd.IPOyear); Assert.AreEqual("Finance", testRcd.Sector); }
private void LoadCompanyDetails(string path, string fileName, string[] columnNames) { var fileToUse = path + fileName; loadFileToDb.FileName = fileToUse; loadFileToDb.Columns = columnNames; loadFileToDb.Delimiter = delimiter; loadFileToDb.IsETF = isETF; loadFileToDb.IsMutaulFund = isMutualFund; loadFileToDb.ParseCompanyDetailsFile(); //loadFileToDb.SaveRecordsToDb(_repository); }