/// <summary>
        /// Initializes a new instance of the <see cref="CalculateProbabilityProvider" /> class.
        /// </summary>
        /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param>
        /// <param name="poster">A <see cref="IDataPoster" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{CalculationResponseType}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{CalculationResponseType, CalculationDTO}" /> used to construct instances of <see cref="ISingleTypeMapper{CalculationDTO}" /></param>
        public CalculateProbabilityProvider(string uriFormat, IDataPoster poster, IDeserializer <CalculationResponseType> deserializer, ISingleTypeMapperFactory <CalculationResponseType, CalculationDTO> mapperFactory)
        {
            if (string.IsNullOrWhiteSpace(uriFormat))
            {
                throw new ArgumentOutOfRangeException(nameof(uriFormat));
            }
            if (poster == null)
            {
                throw new ArgumentNullException(nameof(poster));
            }
            if (deserializer == null)
            {
                throw new ArgumentNullException(nameof(deserializer));
            }
            if (mapperFactory == null)
            {
                throw new ArgumentNullException(nameof(mapperFactory));
            }

            _uriFormat     = uriFormat;
            _poster        = poster;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
            _serializer    = new XmlSerializer(typeof(SelectionsType));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="TournamentRaceScheduleProvider"/> class
 /// </summary>
 /// <param name="dateScheduleUriFormat">An address format used to retrieve sport events for a specified date</param>
 /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
 /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param>
 /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param>
 public TournamentRaceScheduleProvider(string dateScheduleUriFormat,
                                       IDataFetcher fetcher,
                                       IDeserializer <raceScheduleEndpoint> deserializer,
                                       ISingleTypeMapperFactory <raceScheduleEndpoint, EntityList <SportEventSummaryDTO> > mapperFactory)
     : base(dateScheduleUriFormat, fetcher, deserializer, mapperFactory)
 {
     Guard.Argument(dateScheduleUriFormat, nameof(dateScheduleUriFormat)).NotNull().NotEmpty();
     Guard.Argument(fetcher, nameof(fetcher)).NotNull();
     Guard.Argument(deserializer, nameof(deserializer)).NotNull();
     Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListSportAvailableTournamentProvider"/> class
 /// </summary>
 /// <param name="baseUriFormat">An address format used to retrieve list of sport events</param>
 /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
 /// <param name="deserializer">A <see cref="IDeserializer{sportTournamentsEndpoint}" /> used to deserialize the fetch data</param>
 /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{sportTournamentsEndpoint, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ITournament}" /></param>
 public ListSportAvailableTournamentProvider(string baseUriFormat,
                                             IDataFetcher fetcher,
                                             IDeserializer <sportTournamentsEndpoint> deserializer,
                                             ISingleTypeMapperFactory <sportTournamentsEndpoint, EntityList <TournamentInfoDTO> > mapperFactory)
     : base(baseUriFormat, fetcher, deserializer, mapperFactory)
 {
     Guard.Argument(baseUriFormat, nameof(baseUriFormat)).NotNull().NotEmpty();
     Guard.Argument(fetcher, nameof(fetcher)).NotNull();
     Guard.Argument(deserializer, nameof(deserializer)).NotNull();
     Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();
 }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class.
        /// </summary>
        /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{T, T1}" /> used to construct instances of <see cref="ISingleTypeMapper{T}" /></param>
        public DataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <TIn> deserializer, ISingleTypeMapperFactory <TIn, TOut> mapperFactory)
        {
            Guard.Argument(uriFormat, nameof(uriFormat)).NotNull().NotEmpty();
            Guard.Argument(fetcher, nameof(fetcher)).NotNull();
            Guard.Argument(deserializer, nameof(deserializer)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();

            _uriFormat     = uriFormat;
            _fetcher       = fetcher;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DataProvider{T, T1}" /> class.
        /// </summary>
        /// <param name="uriFormat">The url format specifying the url of the resources fetched by the fetcher</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{T, T1}" /> used to construct instances of <see cref="ISingleTypeMapper{T}" /></param>
        public DataProvider(string uriFormat, IDataFetcher fetcher, IDeserializer <TIn> deserializer, ISingleTypeMapperFactory <TIn, TOut> mapperFactory)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(uriFormat));
            Contract.Requires(fetcher != null);
            Contract.Requires(deserializer != null);
            Contract.Requires(mapperFactory != null);

            _uriFormat     = uriFormat;
            _fetcher       = fetcher;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
        }
Пример #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ListSportEventsProvider"/> class
 /// </summary>
 /// <param name="baseUriFormat">An address format used to retrieve list of sport events</param>
 /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
 /// <param name="deserializer">A <see cref="IDeserializer{scheduleEndpoint}" /> used to deserialize the fetch data</param>
 /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleEndpoint, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param>
 public ListSportEventsProvider(
     string baseUriFormat,
     IDataFetcher fetcher,
     IDeserializer <scheduleEndpoint> deserializer,
     ISingleTypeMapperFactory <scheduleEndpoint, EntityList <SportEventSummaryDTO> > mapperFactory)
     : base(baseUriFormat, fetcher, deserializer, mapperFactory)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(baseUriFormat));
     Contract.Requires(fetcher != null);
     Contract.Requires(deserializer != null);
     Contract.Requires(mapperFactory != null);
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="DateScheduleProvider" /> class.
 /// </summary>
 /// <param name="dateScheduleUriFormat">An address format used to retrieve sport events for a specified date</param>
 /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
 /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param>
 /// <param name="mapperFactory">
 ///     A <see cref="ISingleTypeMapperFactory{TIn,TOut}" /> used to construct instances of
 ///     <see cref="ISingleTypeMapper{ISportEventsSchedule}" />
 /// </param>
 public TournamentScheduleProvider(
     string dateScheduleUriFormat,
     IDataFetcher fetcher,
     IDeserializer <tournamentSchedule> deserializer,
     ISingleTypeMapperFactory <tournamentSchedule, EntityList <SportEventSummaryDTO> > mapperFactory)
     : base(dateScheduleUriFormat, fetcher, deserializer, mapperFactory)
 {
     Contract.Requires(!string.IsNullOrWhiteSpace(dateScheduleUriFormat));
     Contract.Requires(fetcher != null);
     Contract.Requires(deserializer != null);
     Contract.Requires(mapperFactory != null);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="SportEventSummaryProvider"/> class
        /// </summary>
        /// <param name="sportEventSummaryUriFormat">An address format used to retrieve sport event summary</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param>
        public SportEventSummaryProvider(
            string sportEventSummaryUriFormat,
            IDataFetcher fetcher,
            IDeserializer <RestMessage> deserializer,
            ISingleTypeMapperFactory <RestMessage, EntityList <SportEventSummaryDTO> > mapperFactory)
            : base(sportEventSummaryUriFormat, fetcher, deserializer, mapperFactory)
        {
            Guard.Argument(sportEventSummaryUriFormat, nameof(sportEventSummaryUriFormat)).NotNull().NotEmpty();
            Guard.Argument(fetcher, nameof(fetcher)).NotNull();
            Guard.Argument(deserializer, nameof(deserializer)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();

            _sportEventSummaryUriFormat = sportEventSummaryUriFormat;
        }
Пример #9
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SportEventSummaryProvider" /> class
        /// </summary>
        /// <param name="sportEventSummaryUriFormat">An address format used to retrieve sport event summary</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{T}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">
        ///     A <see cref="ISingleTypeMapperFactory{TIn,TOut}" /> used to construct instances of
        ///     <see cref="ISingleTypeMapper{ISportEventsSchedule}" />
        /// </param>
        public SportEventSummaryProvider(
            string sportEventSummaryUriFormat,
            IDataFetcher fetcher,
            IDeserializer <RestMessage> deserializer,
            ISingleTypeMapperFactory <RestMessage, EntityList <SportEventSummaryDTO> > mapperFactory)
            : base(sportEventSummaryUriFormat, fetcher, deserializer, mapperFactory)
        {
            Contract.Requires(!string.IsNullOrEmpty(sportEventSummaryUriFormat));
            Contract.Requires(fetcher != null);
            Contract.Requires(deserializer != null);
            Contract.Requires(mapperFactory != null);

            _sportEventSummaryUriFormat = sportEventSummaryUriFormat;
        }
Пример #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BookmakerDetailsProvider"/> class
        /// </summary>
        /// <param name="bookmakerDetailsUriFormat">An address format used to retrieve sport event summary</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" /></param>
        public BookmakerDetailsProvider(
            string bookmakerDetailsUriFormat,
            IDataFetcher fetcher,
            IDeserializer <bookmaker_details> deserializer,
            ISingleTypeMapperFactory <bookmaker_details, BookmakerDetailsDTO> mapperFactory)
            : base(bookmakerDetailsUriFormat, fetcher, deserializer, mapperFactory)
        {
            Guard.Argument(bookmakerDetailsUriFormat, nameof(bookmakerDetailsUriFormat)).NotNull().NotEmpty();
            Guard.Argument(fetcher, nameof(fetcher)).NotNull();
            Guard.Argument(deserializer, nameof(deserializer)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();

            _fetcher       = fetcher;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
        }
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheMessageProcessor"/> class
        /// </summary>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{removeSportEventStatus, SportEventStatusDTO}"/> used to created <see cref="ISingleTypeMapper{SportEventStatusDTO}"/> instances</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to handle <see cref="fixture_change"/></param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param>
        /// <param name="feedMessageHandler">A <see cref="IFeedMessageHandler"/> for handling special cases</param>
        public CacheMessageProcessor(ISingleTypeMapperFactory <sportEventStatus, SportEventStatusDTO> mapperFactory,
                                     ISportEventCache sportEventCache,
                                     ICacheManager cacheManager,
                                     IFeedMessageHandler feedMessageHandler)
        {
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();
            Guard.Argument(cacheManager, nameof(cacheManager)).NotNull();
            Guard.Argument(feedMessageHandler, nameof(feedMessageHandler)).NotNull();

            ProcessorId = "CMP" + Guid.NewGuid().ToString().Substring(0, 4);

            _mapperFactory      = mapperFactory;
            _sportEventCache    = sportEventCache;
            _cacheManager       = cacheManager;
            _feedMessageHandler = feedMessageHandler;
        }
Пример #12
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="BookmakerDetailsProvider" /> class
        /// </summary>
        /// <param name="bookmakerDetailsUriFormat">An address format used to retrieve sport event summary</param>
        /// <param name="fetcher">A <see cref="IDataFetcher" /> used to fetch the data</param>
        /// <param name="deserializer">A <see cref="IDeserializer{scheduleType}" /> used to deserialize the fetch data</param>
        /// <param name="mapperFactory">
        ///     A <see cref="ISingleTypeMapperFactory{scheduleType, EntityList}" /> used to construct
        ///     instances of <see cref="ISingleTypeMapper{ISportEventsSchedule}" />
        /// </param>
        public BookmakerDetailsProvider(
            string bookmakerDetailsUriFormat,
            IDataFetcher fetcher,
            IDeserializer <bookmaker_details> deserializer,
            ISingleTypeMapperFactory <bookmaker_details, BookmakerDetailsDTO> mapperFactory)
            : base(bookmakerDetailsUriFormat, fetcher, deserializer, mapperFactory)
        {
            Contract.Requires(!string.IsNullOrEmpty(bookmakerDetailsUriFormat));
            Contract.Requires(fetcher != null);
            Contract.Requires(deserializer != null);
            Contract.Requires(mapperFactory != null);

            _uriFormat     = bookmakerDetailsUriFormat ?? "{0}/v1/users/whoami.xml";
            _fetcher       = fetcher;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CacheMessageProcessor"/> class
        /// </summary>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{removeSportEventStatus, SportEventStatusDTO}"/> used to created <see cref="ISingleTypeMapper{SportEventStatusDTO}"/> instances</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to handle <see cref="fixture_change"/></param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param>
        /// <param name="feedMessageHandler">A <see cref="IFeedMessageHandler"/> for handling special cases</param>
        public CacheMessageProcessor(ISingleTypeMapperFactory <sportEventStatus, SportEventStatusDTO> mapperFactory,
                                     ISportEventCache sportEventCache,
                                     ICacheManager cacheManager,
                                     IFeedMessageHandler feedMessageHandler)
        {
            Contract.Requires(mapperFactory != null);
            Contract.Requires(sportEventCache != null);
            Contract.Requires(cacheManager != null);
            Contract.Requires(feedMessageHandler != null);

            ProcessorId = "CMP" + Guid.NewGuid().ToString().Substring(0, 4);

            _mapperFactory      = mapperFactory;
            _sportEventCache    = sportEventCache;
            _cacheManager       = cacheManager;
            _feedMessageHandler = feedMessageHandler;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ISportEventStatusCache"/> class
        /// </summary>
        /// <param name="sportEventStatusCache">A <see cref="MemoryCache"/> used to cache <see cref="SportEventStatusCI"/> instances</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{TIn,TOut}"/> used to created <see cref="ISingleTypeMapper{SportEventStatusDTO}"/> instances</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to cache <see cref="ISportEvent"/></param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param>
        /// <param name="ignoreEventsTimelineCache">A <see cref="MemoryCache"/> used to cache event ids for which the SES from timeline endpoint should be ignored</param>
        public SportEventStatusCache(MemoryCache sportEventStatusCache,
                                     ISingleTypeMapperFactory <sportEventStatus, SportEventStatusDTO> mapperFactory,
                                     ISportEventCache sportEventCache,
                                     ICacheManager cacheManager,
                                     MemoryCache ignoreEventsTimelineCache)
            : base(cacheManager)
        {
            Guard.Argument(sportEventStatusCache, nameof(sportEventStatusCache)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();
            Guard.Argument(ignoreEventsTimelineCache, nameof(ignoreEventsTimelineCache)).NotNull();

            _sportEventStatusCache     = sportEventStatusCache;
            _mapperFactory             = mapperFactory;
            _sportEventCache           = sportEventCache;
            _ignoreEventsTimelineCache = ignoreEventsTimelineCache;

            _isDisposed = false;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ISportEventStatusCache"/> class
        /// </summary>
        /// <param name="sportEventStatusCache"> A <see cref="MemoryCache"/> used to cache <see cref="SportEventStatusCI"/> instances</param>
        /// <param name="mapperFactory">A <see cref="ISingleTypeMapperFactory{TIn,TOut}"/> used to created <see cref="ISingleTypeMapper{SportEventStatusDTO}"/> instances</param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache"/> used to cache <see cref="ISportEvent"/></param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to interact among caches</param>
        /// <param name="cacheItemExpireTime">The time in which cache item expires</param>
        public SportEventStatusCache(MemoryCache sportEventStatusCache,
                                     ISingleTypeMapperFactory <sportEventStatus, SportEventStatusDTO> mapperFactory,
                                     ISportEventCache sportEventCache,
                                     ICacheManager cacheManager,
                                     TimeSpan cacheItemExpireTime)
            : base(cacheManager)
        {
            Guard.Argument(sportEventStatusCache, nameof(sportEventStatusCache)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();
            Guard.Argument(sportEventCache, nameof(sportEventCache)).NotNull();

            _sportEventStatusCache = sportEventStatusCache;
            _mapperFactory         = mapperFactory;
            _sportEventCache       = sportEventCache;

            _isDisposed          = false;
            _cacheItemExpireTime = cacheItemExpireTime <= TimeSpan.Zero
                                       ? TimeSpan.FromMinutes(5)
                                       : cacheItemExpireTime;
        }
Пример #16
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ISportEventStatusCache" /> class
        /// </summary>
        /// <param name="sportEventStatusCache">
        ///     A <see cref="MemoryCache" /> used to cache <see cref="SportEventStatusCI" />
        ///     instances
        /// </param>
        /// <param name="mapperFactory">
        ///     A <see cref="ISingleTypeMapperFactory{TIn,TOut}" /> used to created
        ///     <see cref="ISingleTypeMapper{SportEventStatusDTO}" /> instances
        /// </param>
        /// <param name="sportEventCache">A <see cref="ISportEventCache" /> used to cache <see cref="ISportEvent" /></param>
        /// <param name="cacheManager">A <see cref="ICacheManager" /> used to interact among caches</param>
        /// <param name="cacheItemExpireTime">The time in which cache item expires</param>
        public SportEventStatusCache(MemoryCache sportEventStatusCache,
                                     ISingleTypeMapperFactory <sportEventStatus, SportEventStatusDTO> mapperFactory,
                                     ISportEventCache sportEventCache,
                                     ICacheManager cacheManager,
                                     TimeSpan cacheItemExpireTime)
            : base(cacheManager)
        {
            Contract.Requires(sportEventStatusCache != null);
            Contract.Requires(mapperFactory != null);
            Contract.Requires(sportEventCache != null);

            _sportEventStatusCache = sportEventStatusCache;
            _mapperFactory         = mapperFactory;
            _sportEventCache       = sportEventCache;

            _isDisposed          = false;
            _cacheItemExpireTime = cacheItemExpireTime <= TimeSpan.Zero
                ? TimeSpan.FromMinutes(5)
                : cacheItemExpireTime;
        }