public override void MigrateMatchDetails(int matchId, int matchRound, int season, int leagueId) { var matchDetailsRaw = new MatchDetails(ProtectedResourceUrl) { MatchID = matchId, MatchEvents = true }; var request = new WhoScoredRequest(); string response = request.MakeRequest(matchDetailsRaw.GetHattrickFileAccessorAbsoluteUri()); var matchDetails = CHPP.MatchDetails.Serializer.HattrickData.Deserialize(response); matchDetails.Match.First().MatchSeason = season.ToString(); matchDetails.Match.First().LeagueLevelUnitID = leagueId.ToString(); matchDetails.Match.First().MatchRound = matchRound; var dbSevice = new WhoScoredRepository(); dbSevice.SaveMatchDetails(matchDetails.Match); }
public void MigrateMatchDetailsTest_FromXmlToDb() { string strFile = "matchdetails.xml"; string response = GetXmlString(strFile); var matchDetailsInput = CHPP.MatchDetails.Serializer.HattrickData.Deserialize(response).Match.First(); IWhoScoredRepository repository = new WhoScoredRepository(); repository.SaveMatchDetails(matchDetailsInput); Thread.Sleep(1000); var matchDetails = repository.GetMatchDetails<MatchDetails>(); repository.DropSeriesFixtures(); Assert.AreEqual(1, matchDetails.Count); }