示例#1
0
        public async Task ValidData_ParsedCorrectly()
        {
            var mockDataLoader = new MockDataLoader("Uk_Race_Valid.json");
            var unitUnderTest  = new UkJsonRaceDataProvider(mockDataLoader);
            var result         = await unitUnderTest.GetRaceDataAsync("mockRaceId");

            var horseList = result.Horses.ToList();

            Assert.Equal("13:45 @ Wolverhampton", result.RaceName);
            Assert.Equal(2, horseList.Count);

            Assert.Equal("Toolatetodelegate", horseList[0].HorseName);
            Assert.Equal(10.0M, horseList[0].Price);
            Assert.Equal("Fikhaar", horseList[1].HorseName);
            Assert.Equal(4.4M, horseList[1].Price);
        }
示例#2
0
 public async Task EmptyFile_ThrowsRaceDataInvalidException()
 {
     var mockDataLoader = new MockDataLoader("Uk_Race_EmptyFile.json");
     var unitUnderTest  = new UkJsonRaceDataProvider(mockDataLoader);
     await Assert.ThrowsAsync <RaceDataInvalidException>(async() => await unitUnderTest.GetRaceDataAsync("mockRaceId"));
 }