public void MatchDetailsAccessor_ProvideNotAllowedChar_ExpectFixedUrl() { const string protectedUrl = "thisIs ProtectedUrl"; var matchDetails = new MatchDetails(protectedUrl); string result = matchDetails.GetHattrickFileAccessorAbsoluteUri(); string expectedUrl = string.Format("{0}?{1}", "thisIs%20%20ProtectedUrl", "file=matchdetails&version=2.3"); Assert.AreEqual(result, expectedUrl); }
public void MatchDetailsAccessor_DefaultBehaviout_ExpectDefaultUrl() { const string protectedUrl = "thisIsProtectedUrl"; var matchDetails = new MatchDetails(protectedUrl); string result = matchDetails.GetHattrickFileAccessorAbsoluteUri(); string expectedUrl = string.Format("{0}?{1}", protectedUrl, "file=matchdetails&version=2.3"); Assert.AreEqual(result, expectedUrl); }
public void MatchDetailsAccessor_ProvideMatchId_ExpectLegueIdInUrl() { const string protectedUrl = "thisIsProtectedUrl"; var matchDetails = new MatchDetails(protectedUrl); const int matchId = 1234; matchDetails.MatchID = matchId; string result = matchDetails.GetHattrickFileAccessorAbsoluteUri(); string expectedUrl = string.Format("{0}?{1}&{2}={3}", protectedUrl, "file=matchdetails&version=2.3", "matchID", matchId.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(result, expectedUrl); }
public void MatchDetailsAccessor_ProvideMatchEvents_ExpectSeasonInUrl() { const string protectedUrl = "thisIsProtectedUrl"; var matchDetails = new MatchDetails(protectedUrl); const bool matchEvents = true; matchDetails.MatchEvents = matchEvents; string result = matchDetails.GetHattrickFileAccessorAbsoluteUri(); string expectedUrl = string.Format("{0}?{1}&{2}={3}", protectedUrl, "file=matchdetails&version=2.3", "matchEvents", matchEvents.ToString(CultureInfo.InvariantCulture)); Assert.AreEqual(result, expectedUrl); }
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); }
protected CHPP.MatchDetails.Serializer.HattrickData GetMatchDetails(int matchId) { 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); return matchDetails; }
public void MatchDetailsAccessor_SetMatchIdToNull_ExpectNoLegueIdInUrl() { const string protectedUrl = "thisIsProtectedUrl"; var matchDetails = new MatchDetails(protectedUrl); matchDetails.MatchID = null; string result = matchDetails.GetHattrickFileAccessorAbsoluteUri(); string expectedUrl = string.Format("{0}?{1}", protectedUrl, "file=matchdetails&version=2.3"); Assert.AreEqual(result, expectedUrl); }