public void ShouldDesrializeJsonProperly() { var jsonContents = RaceFileReader.ReadFile("FeedData/Wolferhampton_Race1.json"); var race = _parser.ProcessFileContent(jsonContents); Assert.True(race.Name == "13:45 @ Wolverhampton"); Assert.True(race.Horses.Count() == 2); // TODO: Round double to ensure no weirdness with precision Assert.True(race.Horses.First().Name == "Toolatetodelegate" && race.Horses.First().Price == 10.0); }
public void ShouldDesrializeXmlProperly() { var xmlContents = RaceFileReader.ReadFile("FeedData/Caulfield_Race1.xml"); var race = _parser.ProcessFileContent(xmlContents); Assert.True(race.Name == "Evergreen Turf Plate"); Assert.True(race.Horses.Count() == 2); // TODO: Round double to ensure no weirdness with precision Assert.True(race.Horses.First().Name == "Advancing" && race.Horses.First().Price == 4.2); }
static void Main(string[] args) { // TODO: Create some logic that loops through all files in the FeedData and loads them automatically, rather // than picking out files specifically // TODO: Potentially use a factory to provide the correct parser based on extension. Could then just use // the parser interface instead of concerete classes here. var xmlParser = new XmlFileParser(); var jsonParser = new JsonFileParser(); var content = RaceFileReader.ReadFile("FeedData/Caulfield_Race1.xml"); var xmlRace = xmlParser.ProcessFileContent(content); var jsonContent = RaceFileReader.ReadFile("FeedData/Wolferhampton_Race1.json"); var jsonRace = jsonParser.ProcessFileContent(jsonContent); RaceOutputter.OutputByHorsePrice(xmlRace); RaceOutputter.OutputByHorsePrice(jsonRace); }