public void ReplaceCourseNameWithCourseID() { HistoricDataReader reader = new HistoricDataReader(); // @"C:\Users\carra\Documents\HotTipster\HotTipsHistoricData.txt"); IList <RaceCourse> rcList = ReadWriteToSQLite.RetrieveRaceCourseNamesFromDB(); List <HorseBet> historicBets = reader.ListOfHistoricHorseBetsOriginal(); foreach (var bet in historicBets) { var id = (from rc in rcList where rc.RaceCourseName == bet.RaceCourseName select rc.RaceCourseID).ToArray(); bet.CourseID = id[0]; } List <HorseBet> actualResult = historicBets; List <HorseBet> expectedResult = expectedResult = reader.ListOfHistoricHorseBetsWithCourseID(); Assert.AreEqual(expectedResult.Count, actualResult.Count); Assert.AreEqual(expectedResult[0].CourseID, actualResult[0].CourseID); Assert.AreEqual(expectedResult[0].RaceCourseName, actualResult[0].RaceCourseName); Assert.AreEqual(expectedResult[0].RaceDate, actualResult[0].RaceDate); Assert.AreEqual(expectedResult[10].CourseID, actualResult[10].CourseID); Assert.AreEqual(expectedResult[10].RaceCourseName, actualResult[10].RaceCourseName); Assert.AreEqual(expectedResult[10].RaceDate, actualResult[10].RaceDate); //Assert.AreEqual(expectedResult[0], actualResult[0]); //Error = Assert.AreEqual failed. Expected:<HotTipster.HorseBet>. Actual:<HotTipster.HorseBet>. //CollectionAssert.AreEquivalent(expectedResult, actualResult); // Can't get this to work }
public HotTipsterMenu() { InitializeComponent(); ReadWriteToSQLite sqldb = new ReadWriteToSQLite(); HistoricDataReader reader = new HistoricDataReader(); // @"C:\Users\carra\Documents\HotTipster\HotTipsHistoricData.txt"); //Replace with directory ref? if (!File.Exists(Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "HotTipster.db")) { sqldb.CreateDatabase(); sqldb.InsertExistingRaceCoursesIntoDB(); //sqldb.InsertListOfBets(reader.ListOfHistoricHorseBetsOriginal()); sqldb.InsertListOfBets(HorseBet.AddCourseIDToHistoricBetData()); } }
public List <string> ExistingRaceCourseNames() { HistoricDataReader myReader = new HistoricDataReader(); // @"C:\Users\carra\Documents\HotTipster\HotTipsHistoricData.txt"); List <HorseBet> historicBets = myReader.ListOfHistoricHorseBetsOriginal(); var groupednames = historicBets.GroupBy(x => x.RaceCourseName); List <string> names = new List <string>(); foreach (var rcGroup in groupednames) { names.Add(rcGroup.Key.ToString()); } names.Sort(); return(names); }
public static List <HorseBet> AddCourseIDToHistoricBetData() { //ReadWriteToSQLite writer = new ReadWriteToSQLite(); HistoricDataReader reader = new HistoricDataReader(); //@"C:\Users\carra\Documents\HotTipster\HotTipsHistoricData.txt"); List <RaceCourse> rcList = ReadWriteToSQLite.RetrieveRaceCourseNamesFromDB(); List <HorseBet> historicBets = reader.ListOfHistoricHorseBetsOriginal(); foreach (var bet in historicBets) { var id = (from rc in rcList where rc.RaceCourseName == bet.RaceCourseName select rc.RaceCourseID).ToArray(); bet.CourseID = id[0]; } return(historicBets); }
public void Initialize() { myReader = new HistoricDataReader(); //@"C:\Users\carra\Documents\HotTipster\HotTipsHistoricData.txt"); }