/// <summary>
        /// Initializes a new instance of the <see cref="SportDataProvider"/> class
        /// </summary>
        /// <param name="sportEntityFactory">A <see cref="ISportEntityFactory"/> used to construct <see cref="ITournament"/> instances</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to retrieve schedules for sport events</param>
        /// <param name="sportEventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve status for sport event</param>
        /// <param name="profileCache">A <see cref="IProfileCache"/> used to retrieve competitor or player profile</param>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> used to retrieve sport data</param>
        /// <param name="defaultCultures"> A <see cref="IList{CultureInfo}"/> specified as default cultures (from configuration)</param>
        /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying enum member specifying how instances provided by the current provider will handle exceptions</param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param>
        /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param>
        /// <param name="dataRouterManager">A <see cref="IDataRouterManager"/> used to invoke API requests</param>
        public SportDataProvider(ISportEntityFactory sportEntityFactory,
                                 ISportEventCache sportEventCache,
                                 ISportEventStatusCache sportEventStatusCache,
                                 IProfileCache profileCache,
                                 ISportDataCache sportDataCache,
                                 IEnumerable <CultureInfo> defaultCultures,
                                 ExceptionHandlingStrategy exceptionStrategy,
                                 ICacheManager cacheManager,
                                 ILocalizedNamedValueCache matchStatusCache,
                                 IDataRouterManager dataRouterManager)
        {
            Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();
            Guard.Argument(profileCache, nameof(profileCache)).NotNull();
            Guard.Argument(defaultCultures, nameof(defaultCultures)).NotNull().NotEmpty();
            Guard.Argument(cacheManager, nameof(cacheManager)).NotNull();
            Guard.Argument(matchStatusCache, nameof(matchStatusCache)).NotNull();
            Guard.Argument(dataRouterManager, nameof(dataRouterManager)).NotNull();

            _sportEntityFactory    = sportEntityFactory;
            _sportEventCache       = sportEventCache;
            _sportEventStatusCache = sportEventStatusCache;
            _profileCache          = profileCache;
            _sportDataCache        = sportDataCache;
            _defaultCultures       = defaultCultures as IReadOnlyCollection <CultureInfo>;
            _exceptionStrategy     = exceptionStrategy;
            _cacheManager          = cacheManager;
            _matchStatusCache      = matchStatusCache;
            _dataRouterManager     = dataRouterManager;
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Draw"/> class
        /// </summary>
        /// <param name="id">A <see cref="URN"/> uniquely identifying the sport event associated with the current instance</param>
        /// <param name="sportId">A <see cref="URN"/> uniquely identifying the sport associated with the current instance</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance containing <see cref="SportEventCI"/></param>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> instance used to retrieve basic tournament information</param>
        /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param>
        /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the initialized instance will handle potential exceptions</param>
        public Lottery(URN id,
                       URN sportId,
                       ISportEventCache sportEventCache,
                       ISportDataCache sportDataCache,
                       IEnumerable <CultureInfo> cultures,
                       ExceptionHandlingStrategy exceptionStrategy)
            : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy)
        {
            Contract.Requires(sportDataCache != null);

            _sportDataCache = sportDataCache;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Draw"/> class
        /// </summary>
        /// <param name="id">A <see cref="URN"/> uniquely identifying the sport event associated with the current instance</param>
        /// <param name="sportId">A <see cref="URN"/> uniquely identifying the sport associated with the current instance</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance containing <see cref="SportEventCI"/></param>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> instance used to retrieve basic tournament information</param>
        /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying languages the current instance supports</param>
        /// <param name="exceptionStrategy">A <see cref="ExceptionHandlingStrategy"/> enum member specifying how the initialized instance will handle potential exceptions</param>
        public Lottery(URN id,
                       URN sportId,
                       ISportEventCache sportEventCache,
                       ISportDataCache sportDataCache,
                       IEnumerable <CultureInfo> cultures,
                       ExceptionHandlingStrategy exceptionStrategy)
            : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy)
        {
            Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull();

            _sportDataCache = sportDataCache;
        }
예제 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BasicTournament"/> class
        /// </summary>
        /// <param name="id">The identifier</param>
        /// <param name="sportId">The sport identifier</param>
        /// <param name="sportEntityFactory">An instance of a <see cref="ISportEntityFactory"/> used to create <see cref="ISportEvent"/> instances</param>
        /// <param name="sportEventCache">The sport event cache</param>
        /// <param name="sportDataCache">The sport data cache</param>
        /// <param name="cultures">The cultures</param>
        /// <param name="exceptionStrategy">The exception strategy</param>
        public BasicTournament(URN id,
                               URN sportId,
                               ISportEntityFactory sportEntityFactory,
                               ISportEventCache sportEventCache,
                               ISportDataCache sportDataCache,
                               IEnumerable <CultureInfo> cultures,
                               ExceptionHandlingStrategy exceptionStrategy)
            : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy)
        {
            Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull();
            Guard.Argument(sportEntityFactory, nameof(sportEntityFactory)).NotNull();

            _sportEntityFactory = sportEntityFactory;
            _sportDataCache     = sportDataCache;
        }
예제 #5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="BasicTournament" /> class
        /// </summary>
        /// <param name="id">The identifier</param>
        /// <param name="sportId">The sport identifier</param>
        /// <param name="sportEntityFactory">
        ///     An instance of a <see cref="ISportEntityFactory" /> used to create
        ///     <see cref="ISportEvent" /> instances
        /// </param>
        /// <param name="sportEventCache">The sport event cache</param>
        /// <param name="sportDataCache">The sport data cache</param>
        /// <param name="cultures">The cultures</param>
        /// <param name="exceptionStrategy">The exception strategy</param>
        public BasicTournament(URN id,
                               URN sportId,
                               ISportEntityFactory sportEntityFactory,
                               ISportEventCache sportEventCache,
                               ISportDataCache sportDataCache,
                               IEnumerable <CultureInfo> cultures,
                               ExceptionHandlingStrategy exceptionStrategy)
            : base(id, sportId, ExecutionLogPrivate, sportEventCache, cultures, exceptionStrategy)
        {
            Contract.Requires(sportDataCache != null);
            Contract.Requires(sportEntityFactory != null);

            _sportEntityFactory = sportEntityFactory;
            _sportDataCache     = sportDataCache;
        }
        public TestSportEntityFactory(ISportDataCache sportDataCache             = null,
                                      ISportEventCache sportEventCache           = null,
                                      ISportEventStatusCache eventStatusCache    = null,
                                      ILocalizedNamedValueCache matchStatusCache = null,
                                      IProfileCache profileCache = null,
                                      IReadOnlyCollection <URN> soccerSportUrns = null)
        {
            _cacheManager = new CacheManager();
            var profileMemoryCache = new MemoryCache("ProfileCache");

            _sportDataCache   = sportDataCache;
            _sportEventCache  = sportEventCache;
            _eventStatusCache = eventStatusCache;
            _matchStatusCache = matchStatusCache;
            _profileCache     = profileCache ?? new ProfileCache(profileMemoryCache, new TestDataRouterManager(_cacheManager), _cacheManager);
            _soccerSportUrns  = soccerSportUrns ?? SdkInfo.SoccerSportUrns;
        }
예제 #7
0
        public Stage(URN id,
                     URN sportId,
                     ISportEntityFactory sportEntityFactory,
                     ISportEventCache sportEventCache,
                     ISportDataCache sportDataCache,
                     ISportEventStatusCache sportEventStatusCache,
                     ILocalizedNamedValueCache matchStatusesCache,
                     IEnumerable <CultureInfo> cultures,
                     ExceptionHandlingStrategy exceptionStrategy)
            : base(ExecutionLogPrivate, id, sportId, sportEntityFactory, sportEventStatusCache, sportEventCache, cultures, exceptionStrategy, matchStatusesCache)
        {
            Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull();
            Guard.Argument(matchStatusesCache, nameof(matchStatusesCache)).NotNull();

            _sportEntityFactory = sportEntityFactory;
            _sportDataCache     = sportDataCache;
        }
예제 #8
0
        public Stage(URN id,
                     URN sportId,
                     ISportEntityFactory sportEntityFactory,
                     ISportEventCache sportEventCache,
                     ISportDataCache sportDataCache,
                     ISportEventStatusCache sportEventStatusCache,
                     ILocalizedNamedValueCache matchStatusesCache,
                     IEnumerable <CultureInfo> cultures,
                     ExceptionHandlingStrategy exceptionStrategy)
            : base(ExecutionLogPrivate, id, sportId, sportEntityFactory, sportEventStatusCache, sportEventCache, cultures, exceptionStrategy, matchStatusesCache)
        {
            Contract.Requires(sportDataCache != null);
            Contract.Requires(matchStatusesCache != null);

            _sportEntityFactory = sportEntityFactory;
            _sportDataCache     = sportDataCache;
            _matchStatusesCache = matchStatusesCache;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEntityFactory"/> class
        /// </summary>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> instance used to retrieve sport related info</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance used to retrieve sport events</param>
        /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve statuses of sport events</param>
        /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param>
        /// <param name="profileCache">A <see cref="IProfileCache"/> used to retrieve player profiles</param>
        public SportEntityFactory(
            ISportDataCache sportDataCache,
            ISportEventCache sportEventCache,
            ISportEventStatusCache eventStatusCache,
            ILocalizedNamedValueCache matchStatusCache,
            IProfileCache profileCache)
        {
            Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();
            Guard.Argument(eventStatusCache, nameof(eventStatusCache)).NotNull();
            Guard.Argument(matchStatusCache, nameof(matchStatusCache)).NotNull();
            Guard.Argument(profileCache, nameof(profileCache)).NotNull();

            _sportDataCache   = sportDataCache;
            _sportEventCache  = sportEventCache;
            _eventStatusCache = eventStatusCache;
            _matchStatusCache = matchStatusCache;
            _profileCache     = profileCache;
        }
예제 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEntityFactory"/> class
        /// </summary>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> instance used to retrieve sport related info</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance used to retrieve sport events</param>
        /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve statuses of sport events</param>
        /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param>
        /// <param name="profileCache">A <see cref="IProfileCache"/> used to retrieve player profiles</param>
        public SportEntityFactory(
            ISportDataCache sportDataCache,
            ISportEventCache sportEventCache,
            ISportEventStatusCache eventStatusCache,
            ILocalizedNamedValueCache matchStatusCache,
            IProfileCache profileCache)
        {
            Contract.Requires(sportDataCache != null);
            Contract.Requires(sportEventCache != null);
            Contract.Requires(eventStatusCache != null);
            Contract.Requires(matchStatusCache != null);
            Contract.Requires(profileCache != null);

            _sportDataCache   = sportDataCache;
            _sportEventCache  = sportEventCache;
            _eventStatusCache = eventStatusCache;
            _matchStatusCache = matchStatusCache;
            _profileCache     = profileCache;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEntityFactory"/> class
        /// </summary>
        /// <param name="sportDataCache">A <see cref="ISportDataCache"/> instance used to retrieve sport related info</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> instance used to retrieve sport events</param>
        /// <param name="eventStatusCache">A <see cref="ISportEventStatusCache"/> used to retrieve statuses of sport events</param>
        /// <param name="matchStatusCache">A <see cref="ILocalizedNamedValueCache"/> used to retrieve match statuses</param>
        /// <param name="profileCache">A <see cref="IProfileCache"/> used to retrieve player profiles</param>
        /// <param name="soccerSportUrns">A list of sport urns that have soccer matches</param>
        public SportEntityFactory(ISportDataCache sportDataCache,
                                  ISportEventCache sportEventCache,
                                  ISportEventStatusCache eventStatusCache,
                                  ILocalizedNamedValueCache matchStatusCache,
                                  IProfileCache profileCache,
                                  IReadOnlyCollection <URN> soccerSportUrns)
        {
            Guard.Argument(sportDataCache, nameof(sportDataCache)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();
            Guard.Argument(eventStatusCache, nameof(eventStatusCache)).NotNull();
            Guard.Argument(matchStatusCache, nameof(matchStatusCache)).NotNull();
            Guard.Argument(profileCache, nameof(profileCache)).NotNull();
            Guard.Argument(soccerSportUrns, nameof(soccerSportUrns)).NotNull();

            _sportDataCache   = sportDataCache;
            _sportEventCache  = sportEventCache;
            _eventStatusCache = eventStatusCache;
            _matchStatusCache = matchStatusCache;
            _profileCache     = profileCache;
            _soccerSportUrns  = soccerSportUrns;
        }