Exemple #1
0
        public void ReadCaulfieldRace_Withfile_Sucess()
        {
            //Arrange
            _dataClient.ReadXmlData(Arg.Any <string>()).Returns(RaceResponse());

            //Act
            var caulfieldRaceData = _caulfieldRaceClient.GetRacesData();

            //Assert
            Assert.NotNull(caulfieldRaceData);
            Assert.Single(caulfieldRaceData);
            Assert.Equal(1, caulfieldRaceData[0].Id);
            Assert.Equal("Test Horse 1", caulfieldRaceData[0].Name);
            Assert.Equal(4.2m, caulfieldRaceData[0].Price);
        }
Exemple #2
0
        public List <HorseDetails> GetHorseData(SortOrder sortOrder)
        {
            var data = _wolferhamptonRaceClient.GetRacesData();

            data.AddRange(_caulfieldRaceClient.GetRacesData());
            return(sortOrder == SortOrder.Ascending ? data.OrderBy(s => s.Price).ToList() : data.OrderByDescending(s => s.Price).ToList());
        }
Exemple #3
0
        public void ReadBothRaceRaces_Withfile_Sucess()
        {
            //Arrange
            _caulfieldRaceClient.GetRacesData().Returns(CaulfieldRaceResponse());
            _wolferhamptonRaceClient.GetRacesData().Returns(WolferhamptonResponse());

            //Act
            var raceData = _service.GetHorseData(SortOrder.Ascending);

            //Assert
            Assert.NotNull(raceData);
            Assert.Equal(4, raceData.Count);
            Assert.Equal("Wolferhampton 1", raceData[0].Name);
            Assert.Equal("Caulfield 1", raceData[1].Name);
            Assert.Equal("Wolferhampton 2", raceData[2].Name);
            Assert.Equal("Caulfield 2", raceData[3].Name);
        }