Пример #1
0
        public void VerifyParseHorseDataWithInvalidFeedDataJsonFileFormat()
        {
            var testFilePath = Path.Combine(Directory.GetCurrentDirectory(), @"TestFeedDataFiles\InvalidJson.json");

            Assert.True(File.Exists(testFilePath));

            var jsonParser = new WolferhamptonJsonParserV1();

            Assert.Throws <FeedDataParsingException>(() => jsonParser.ParseHorseData(testFilePath));
        }
Пример #2
0
        public void VerifyParseHorseDataWithValidFeedDataFile()
        {
            var testFilePath = Path.Combine(Directory.GetCurrentDirectory(), @"TestFeedDataFiles\Wolferhampton_Race1.json");

            Assert.True(File.Exists(testFilePath));

            var jsonParser = new WolferhamptonJsonParserV1();
            var horses     = jsonParser.ParseHorseData(testFilePath);

            Assert.Equal(2, horses.Count);
            Assert.Contains(horses, h => h.Name == "Toolatetodelegate" && h.Price == 10);
            Assert.Contains(horses, h => h.Name == "Fikhaar" && h.Price == 4.4);
        }