Exemple #1
0
        public void GetRaceList_ForSeason_WhenRequestedFromRepository(string dir, string path, RequestFactory requestFactory, ResponseMapper responseMapper, int year)
        {
            var ergastClient   = ErgastClientGenerator.ErgastClientWithResponseFromFile(dir, path);
            var raceClient     = new RaceClient(ergastClient, requestFactory, responseMapper);
            var raceRepository = new RaceRepository(raceClient);

            var raceInformationCollection = Task.Run(async() => await raceRepository.GetRaceInformationDtoForSeasonAsync(year)).Result.ToArray();

            Assert.NotNull(raceInformationCollection);
            Assert.Equal(19, raceInformationCollection.Count());

            var firstRace = raceInformationCollection.First();

            Assert.Equal("Albert Park Grand Prix Circuit", firstRace.Circuit);
            Assert.Equal("Australia", firstRace.Country);
            Assert.Equal(9, raceInformationCollection[8].Round);
            Assert.Equal(new DateTime(2015, 11, 29), raceInformationCollection.Last().Date);
        }