public async Task SaveToSavesEachRecord()
        {
            var collection = await OddsCollection.RetrieveFrom(this);

            collection.SaveTo(this);

            Assert.Equal(retrievedOdds, savedOdds);
        }
        public async Task RetrievingFromReturnsCorrectOdds()
        {
            var collection = await OddsCollection.RetrieveFrom(this);

            Assert.Equal(retrievedOdds.Count, collection.Count());
            Assert.Single(collection, x => x.Id == odds1.Id);
            Assert.Single(collection, x => x.Id == odds2.Id);
        }
Esempio n. 3
0
        public void UpdateOdds(IProvider <MatchOdds> oddsProvider, ILogger logger = null)
        {
            var odds             = OddsCollection.RetrieveFrom(oddsProvider).Result;
            int matchedOddsCount = 0;

            foreach (var fixture in _fixtures.Where(f => f.RequiresOdds))
            {
                var matchOdds = odds.FindFor(fixture);
                if (matchOdds != null)
                {
                    fixture.MatchOddsId          = matchOdds.Id;
                    fixture.Competition.BookieId = Convert.ToInt64(matchOdds.CompetitionId);
                    fixture.HomeTeam.BookieName  = matchOdds.HomeTeamName;
                    fixture.AwayTeam.BookieName  = matchOdds.AwayTeamName;
                    matchedOddsCount++;
                }
            }
            logger?.LogInformation($"Odds matched: {matchedOddsCount}");
        }