Exemplo n.º 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);
        }
        public async Task ValidData_ParsedCorrectly()
        {
            var mockDataLoader = new MockDataLoader("Aus_Race_valid.xml");
            var unitUnderTest  = new AusXmlRaceDataProvider(mockDataLoader);

            var result = await unitUnderTest.GetRaceDataAsync("mockRaceId");

            var horseList = result.Horses.ToList();

            Assert.Equal("Caulfield", result.RaceName);
            Assert.Equal(2, horseList.Count);

            Assert.Equal("Advancing", horseList[0].HorseName);
            Assert.Equal(4.2M, horseList[0].Price);
            Assert.Equal("Coronel", horseList[1].HorseName);
            Assert.Equal(12M, horseList[1].Price);
        }
Exemplo n.º 3
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"));
 }
 public async Task NoRaces_ThrowsRaceDataInvalidException()
 {
     var mockDataLoader = new MockDataLoader("Aus_Race_NoRaces.xml");
     var unitUnderTest  = new AusXmlRaceDataProvider(mockDataLoader);
     await Assert.ThrowsAsync <RaceDataInvalidException>(async() => await unitUnderTest.GetRaceDataAsync("mockRaceId"));
 }