public async Task<TennisFixtureViewModel> GetSingleTennisPrediction(string playerASurname, string playerAFirstname, string playerBSurname, string playerBFirstname, int year, string tournamentSlug, bool updateStats = true) { var sport = this.fixtureRepository.GetSport("Tennis"); var tournament = this.fixtureRepository.GetTournamentFromSlug(tournamentSlug); var playerA = this.fixtureRepository.GetTeamOrPlayerFromNameAndMaybeFirstName(playerASurname, playerAFirstname); var playerB = this.fixtureRepository.GetTeamOrPlayerFromNameAndMaybeFirstName(playerBSurname, playerBFirstname); var safeDate = new DateTime(year, 06, 29); var valueOptions = new ValueOptions { CouponDate = safeDate, Tournament = tournament, DontUpdateTennisStats = !updateStats }; var provider = this.predictionProvider.CreatePredictionStrategy(sport); var prediction = (TennisPrediction)await provider.FetchSinglePredictionAsync(playerA, playerB, tournament, valueOptions); var tennisPredictionStat = new TennisPredictionStat { PlayerAGames = prediction.PlayerAGames, PlayerBGames = prediction.PlayerBGames, EPoints = (decimal?)prediction.EPoints, EGames = (decimal?)prediction.EGames, ESets = (decimal?)prediction.ESets }; var tennisMatchDetail = new TennisMatchDetail() { TennisPredictionStat = tennisPredictionStat, TennisPrediction = prediction }; return Mapper.Map<TennisMatchDetail, TennisFixtureViewModel>(tennisMatchDetail); //no idea what HydrateFullTennisMatchDetails was for in the first place, I only need predictions and number of games for now }
protected Model.IValueOptions GetValueOptions(DateTime date, string tournamentString, string oddsSourceString, string sportString) { var tournament = fixtureRepository.GetTournament(tournamentString); var sport = this.fixtureRepository.GetSport(sportString); var source = this.bookmakerRepository.GetExternalSource(oddsSourceString); var valueOptions = new Model.ValueOptions() { CouponDate = date, Sport = sport, OddsSource = source, Tournament = tournament }; return(valueOptions); }
public void CreatesACollectionOfPredictionsForTodaysMatches() { //Arrange matchDate = new DateTime(2013, 02, 06); this.webRepositoryProvider = new ManifestWebRepositoryProvider(); this.mockFixtureRepository = BuildFixtureRepository.Create(); this.mockPredictionRepository = BuildPredictionRepository.Create() .HasTodaysMatchesURL(); var predictionStrategy = new TennisPredictionStrategy(this.mockPredictionRepository.Object, this.mockFixtureRepository.Object, this.webRepositoryProvider); var valueOptions = new Model.ValueOptions() { Sport = new E.Sport { SportName = "Tennis" }, OddsSource = new E.ExternalSource { Source = "Not relevant" }, CouponDate = matchDate, Tournament = new E.Tournament { TournamentName = "Not relevant" } }; //Act var genericPredictions = predictionStrategy.FetchPredictions(valueOptions); //Assert Assert.AreEqual(18, genericPredictions.Count()); genericPredictions.ToList().ForEach(x => { Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1.0, 0.01); }); //spot check Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Ramos" && x.TeamOrPlayerB == "Dutra Silva")); Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Sousa" && x.TeamOrPlayerB == "Gimeno-Traver")); Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Davydenko" && x.TeamOrPlayerB == "Nieminen")); }
public void CreatesACollectionOfPredictionsForTodaysMatches() { //Arrange matchDate = new DateTime(2013, 02, 06); this.webRepositoryProvider = new ManifestWebRepositoryProvider(); this.mockFixtureRepository = BuildFixtureRepository.Create(); this.mockPredictionRepository = BuildPredictionRepository.Create() .HasTodaysMatchesURL(); var predictionStrategy = new TennisPredictionStrategy(this.mockPredictionRepository.Object, this.mockFixtureRepository.Object, this.webRepositoryProvider); var valueOptions = new Model.ValueOptions() { Sport = new E.Sport { SportName = "Tennis" }, OddsSource = new E.ExternalSource { Source = "Not relevant" }, CouponDate = matchDate, Tournament = new E.Tournament { TournamentName = "Not relevant" } }; //Act var genericPredictions = predictionStrategy.FetchPredictions(valueOptions); //Assert Assert.AreEqual(18, genericPredictions.Count()); genericPredictions.ToList().ForEach(x => { Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1.0, 0.01); }); //spot check Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Ramos" && x.TeamOrPlayerB == "Dutra Silva")); Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Sousa" && x.TeamOrPlayerB == "Gimeno-Traver")); Assert.AreEqual(1, genericPredictions.Count(x => x.TeamOrPlayerA == "Davydenko" && x.TeamOrPlayerB == "Nieminen")); }
public void CreatesACollectionOfPredictionsForTodaysMatches() { //Arrange matchDate = new DateTime(2013, 02, 02); #region Todays matches matches = new List <E.Match>() { new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "62", Name = "QPR" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "31", Name = "Norwich" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "0", Name = "Arsenal" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "39", Name = "Stoke" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "7", Name = "Everton" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "1", Name = "Aston Villa" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "14", Name = "Newcastle" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "6", Name = "Chelsea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "35", Name = "Reading" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "16", Name = "Sunderland" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "19", Name = "West Ham" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "88", Name = "Swansea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "66", Name = "Wigan" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "15", Name = "Southampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "8", Name = "Fulham" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "12", Name = "Man United" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2", Name = "Birmingham" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "32", Name = "Nott'm Forest" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "3", Name = "Blackburn" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "47", Name = "Bristol City" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "45", Name = "Blackpool" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "44", Name = "Barnsley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "24", Name = "Crystal Palace" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "5", Name = "Charlton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "25", Name = "Derby" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "53", Name = "Huddersfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "28", Name = "Ipswich" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "13", Name = "Middlesboro" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "9", Name = "Leeds" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "48", Name = "Cardiff" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "30", Name = "Millwall" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "77", Name = "Hull" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "59", Name = "Peterboro" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "22", Name = "Burnley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "38", Name = "Sheffield Weds" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "21", Name = "Brighton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "41", Name = "Watford" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "4", Name = "Bolton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "71", Name = "Bury" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "95", Name = "Doncaster" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "52", Name = "Crewe" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "85", Name = "Scunthorpe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "76", Name = "Hartlepool" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "57", Name = "Notts County" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "42", Name = "Milton Keynes" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "69", Name = "Bournemouth" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "33", Name = "Portsmouth" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "51", Name = "Colchester" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "34", Name = "Preston" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "86", Name = "Shrewsbury" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2015", Name = "Stevenage" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "79", Name = "Leyton Orient" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "65", Name = "Tranmere" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "73", Name = "Carlisle" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "40", Name = "Walsall" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "58", Name = "Oldham" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "96", Name = "Yeovil" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "46", Name = "Brentford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2004", Name = "Crawley Town" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "64", Name = "Swindon" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2029", Name = "AFC Wimbledon" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2002", Name = "Burton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "49", Name = "Cheltenham" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "89", Name = "Torquay" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "75", Name = "Exeter" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2000", Name = "Aldershot" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2033", Name = "Fleetwood Town" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "20", Name = "Bradford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "60", Name = "Plymouth" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2005", Name = "Dag and Red" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "61", Name = "Port Vale" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "97", Name = "Accrington" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "83", Name = "Rochdale" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "50", Name = "Chesterfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "36", Name = "Rotherham" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "56", Name = "Northampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "87", Name = "Southend" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "82", Name = "Oxford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } }, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "91", Name = "York" }, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2009", Name = "Morecambe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" } } } }; #endregion this.webRepositoryProvider = new ManifestWebRepositoryProvider(); this.mockFixtureRepository = BuildFixtureRepository.Create() .HasFullDaysMatchesByCompetition(matches) .CanGetTournamentEventFromTournamentAndDate(); this.mockPredictionRepository = BuildPredictionRepository.Create() .HasFootballAPIUrl(); var predictionStrategy = new FootballPredictionStrategy(this.mockPredictionRepository.Object, this.mockFixtureRepository.Object, this.webRepositoryProvider); var prem = new E.Tournament() { TournamentName = "Premier League" }; var champ = new E.Tournament() { TournamentName = "Championship" }; var league1 = new E.Tournament() { TournamentName = "League One" }; var league2 = new E.Tournament() { TournamentName = "League Two" }; var valueOptions = new Model.ValueOptions() { Sport = new E.Sport { SportName = "Football" }, OddsSource = new E.ExternalSource { Source = "Not relevant" }, CouponDate = matchDate }; var allGenericPredictions = new List <Model.GenericPrediction>(); //Act //Premier league valueOptions.Tournament = prem; var genericPredictionsPrem = predictionStrategy.FetchPredictions(valueOptions); //Championship valueOptions.Tournament = champ; var genericPredictionsChamp = predictionStrategy.FetchPredictions(valueOptions); //League 1 valueOptions.Tournament = league1; var genericPredictionsLeague1 = predictionStrategy.FetchPredictions(valueOptions); //League 2 valueOptions.Tournament = league2; var genericPredictionsLeague2 = predictionStrategy.FetchPredictions(valueOptions); //All allGenericPredictions.AddRange(genericPredictionsPrem); allGenericPredictions.AddRange(genericPredictionsChamp); allGenericPredictions.AddRange(genericPredictionsLeague1); allGenericPredictions.AddRange(genericPredictionsLeague2); //Assert allGenericPredictions.ForEach(x => { Assert.AreEqual(x.ScoreLineProbabilities.Count(), 121); Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1, 0.01); }); Assert.AreEqual(genericPredictionsPrem.Count(), 8); Assert.AreEqual(genericPredictionsChamp.Count(), 11); Assert.AreEqual(genericPredictionsLeague1.Count(), 11); Assert.AreEqual(genericPredictionsLeague2.Count(), 10); }
protected Model.IValueOptions GetValueOptions(DateTime date, string tournamentString, string oddsSourceString, string sportString) { var tournament = fixtureRepository.GetTournament(tournamentString); var sport = this.fixtureRepository.GetSport(sportString); var source = this.bookmakerRepository.GetExternalSource(oddsSourceString); var valueOptions = new Model.ValueOptions() { CouponDate = date, Sport = sport, OddsSource = source, Tournament = tournament }; return valueOptions; }
private IEnumerable<TennisPrediction> FetchGenericTennisPredictions(DateTime matchDate) { var sport = this.fixtureRepository.GetSport("Tennis"); var tournament = this.fixtureRepository.GetTournament("ATP"); var couponDate = matchDate.Date; var source = this.fixtureRepository.GetExternalSource("Tennis Betting 365"); var valueOptions = new ValueOptions { Tournament = tournament, Sport = sport, CouponDate = matchDate, OddsSource = source }; var predictionStrategy = this.predictionProvider.CreatePredictionStrategy(sport); var tennisPredictions = predictionStrategy.FetchPredictions(valueOptions) .Cast<TennisPrediction>() .ToList(); return tennisPredictions; }
public void CreatesACollectionOfPredictionsForTodaysMatches() { //Arrange matchDate = new DateTime(2013, 02, 02); #region Todays matches matches = new List<E.Match>() { new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "62", Name = "QPR"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "31", Name = "Norwich" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "0", Name = "Arsenal"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "39", Name = "Stoke" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "7", Name = "Everton"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "1", Name = "Aston Villa" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "14", Name = "Newcastle"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "6", Name = "Chelsea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "35", Name = "Reading"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "16", Name = "Sunderland" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "19", Name = "West Ham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "88", Name = "Swansea" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "66", Name = "Wigan"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "15", Name = "Southampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "8", Name = "Fulham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "12", Name = "Man United" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Premier League" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2", Name = "Birmingham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "32", Name = "Nott'm Forest" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "3", Name = "Blackburn"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "47", Name = "Bristol City" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "45", Name = "Blackpool"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "44", Name = "Barnsley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "24", Name = "Crystal Palace"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "5", Name = "Charlton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "25", Name = "Derby"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "53", Name = "Huddersfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "28", Name = "Ipswich"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "13", Name = "Middlesboro" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "9", Name = "Leeds"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "48", Name = "Cardiff" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "30", Name = "Millwall"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "77", Name = "Hull" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "59", Name = "Peterboro"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "22", Name = "Burnley" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "38", Name = "Sheffield Weds"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "21", Name = "Brighton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "41", Name = "Watford"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "4", Name = "Bolton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "Championship" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "71", Name = "Bury"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "95", Name = "Doncaster" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "52", Name = "Crewe"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "85", Name = "Scunthorpe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "76", Name = "Hartlepool"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "57", Name = "Notts County" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "42", Name = "Milton Keynes"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "69", Name = "Bournemouth" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "33", Name = "Portsmouth"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "51", Name = "Colchester" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "34", Name = "Preston"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "86", Name = "Shrewsbury" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2015", Name = "Stevenage"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "79", Name = "Leyton Orient" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "65", Name = "Tranmere"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "73", Name = "Carlisle" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "40", Name = "Walsall"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "58", Name = "Oldham" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "96", Name = "Yeovil"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "46", Name = "Brentford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2004", Name = "Crawley Town"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "64", Name = "Swindon" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League One" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2029", Name = "AFC Wimbledon"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2002", Name = "Burton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "49", Name = "Cheltenham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "89", Name = "Torquay" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "75", Name = "Exeter"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2000", Name = "Aldershot" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "2033", Name = "Fleetwood Town"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "20", Name = "Bradford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "60", Name = "Plymouth"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2005", Name = "Dag and Red" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "61", Name = "Port Vale"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "97", Name = "Accrington" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "83", Name = "Rochdale"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "50", Name = "Chesterfield" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "36", Name = "Rotherham"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "56", Name = "Northampton" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "87", Name = "Southend"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "82", Name = "Oxford" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}}, new E.Match() { MatchDate = matchDate, TeamsPlayerA = new E.TeamPlayer { ExternalID = "91", Name = "York"}, TeamsPlayerB = new E.TeamPlayer { ExternalID = "2009", Name = "Morecambe" }, TournamentEvent = new E.TournamentEvent { Tournament = new E.Tournament { TournamentName = "League Two" }}} }; #endregion this.webRepositoryProvider = new ManifestWebRepositoryProvider(); this.mockFixtureRepository = BuildFixtureRepository.Create() .HasFullDaysMatchesByCompetition(matches) .CanGetTournamentEventFromTournamentAndDate(); this.mockPredictionRepository = BuildPredictionRepository.Create() .HasFootballAPIUrl(); var predictionStrategy = new FootballPredictionStrategy(this.mockPredictionRepository.Object, this.mockFixtureRepository.Object, this.webRepositoryProvider); var prem = new E.Tournament() { TournamentName = "Premier League" }; var champ = new E.Tournament() { TournamentName = "Championship" }; var league1 = new E.Tournament() { TournamentName = "League One" }; var league2 = new E.Tournament() { TournamentName = "League Two" }; var valueOptions = new Model.ValueOptions() { Sport = new E.Sport { SportName = "Football" }, OddsSource = new E.ExternalSource { Source = "Not relevant" }, CouponDate = matchDate }; var allGenericPredictions = new List<Model.GenericPrediction>(); //Act //Premier league valueOptions.Tournament = prem; var genericPredictionsPrem = predictionStrategy.FetchPredictions(valueOptions); //Championship valueOptions.Tournament = champ; var genericPredictionsChamp = predictionStrategy.FetchPredictions(valueOptions); //League 1 valueOptions.Tournament = league1; var genericPredictionsLeague1 = predictionStrategy.FetchPredictions(valueOptions); //League 2 valueOptions.Tournament = league2; var genericPredictionsLeague2 = predictionStrategy.FetchPredictions(valueOptions); //All allGenericPredictions.AddRange(genericPredictionsPrem); allGenericPredictions.AddRange(genericPredictionsChamp); allGenericPredictions.AddRange(genericPredictionsLeague1); allGenericPredictions.AddRange(genericPredictionsLeague2); //Assert allGenericPredictions.ForEach(x => { Assert.AreEqual(x.ScoreLineProbabilities.Count(), 121); Assert.AreEqual(x.OutcomeProbabilities.Sum(o => o.Value), 1, 0.01); }); Assert.AreEqual(genericPredictionsPrem.Count(), 8); Assert.AreEqual(genericPredictionsChamp.Count(), 11); Assert.AreEqual(genericPredictionsLeague1.Count(), 11); Assert.AreEqual(genericPredictionsLeague2.Count(), 10); }