/// <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="RecoveryRequestIssuer"/> class
        /// </summary>
        /// <param name="dataPoster">A <see cref="IDataPoster"/> instance used to issue the request to the feed API</param>
        /// <param name="sequenceGenerator">A <see cref="ISequenceGenerator"/> used to generate the sequence numbers</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> used to get nodeId</param>
        public RecoveryRequestIssuer(IDataPoster dataPoster, ISequenceGenerator sequenceGenerator, IOddsFeedConfiguration config)
        {
            Contract.Requires(dataPoster != null);
            Contract.Requires(sequenceGenerator != null);
            Contract.Requires(config != null);

            _dataPoster        = dataPoster;
            _sequenceGenerator = sequenceGenerator;
            _nodeId            = config.NodeId;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BookingManager"/> class
        /// </summary>
        /// <param name="config">The <see cref="IOddsFeedConfigurationInternal"/> representing feed configuration</param>
        /// <param name="dataPoster">A <see cref="IDataProvider{T}"/> used to make HTTP POST requests</param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to save booking status</param>
        public BookingManager(IOddsFeedConfigurationInternal config, IDataPoster dataPoster, ICacheManager cacheManager)
        {
            Contract.Requires(config != null);
            Contract.Requires(dataPoster != null);
            Contract.Requires(cacheManager != null);

            _config       = config;
            _dataPoster   = dataPoster;
            _cacheManager = cacheManager;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BookingManager"/> class
        /// </summary>
        /// <param name="config">The <see cref="IOddsFeedConfigurationInternal"/> representing feed configuration</param>
        /// <param name="dataPoster">A <see cref="IDataProvider{T}"/> used to make HTTP POST requests</param>
        /// <param name="cacheManager">A <see cref="ICacheManager"/> used to save booking status</param>
        public BookingManager(IOddsFeedConfigurationInternal config, IDataPoster dataPoster, ICacheManager cacheManager)
        {
            Guard.Argument(config, nameof(config)).NotNull();
            Guard.Argument(dataPoster, nameof(dataPoster)).NotNull();
            Guard.Argument(cacheManager, nameof(cacheManager)).NotNull();

            _config       = config;
            _dataPoster   = dataPoster;
            _cacheManager = cacheManager;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RecoveryRequestIssuer"/> class
        /// </summary>
        /// <param name="dataPoster">A <see cref="IDataPoster"/> instance used to issue the request to the feed API</param>
        /// <param name="sequenceGenerator">A <see cref="ISequenceGenerator"/> used to generate the sequence numbers</param>
        /// <param name="config">The <see cref="IOddsFeedConfiguration"/> used to get nodeId</param>
        public RecoveryRequestIssuer(IDataPoster dataPoster, ISequenceGenerator sequenceGenerator, IOddsFeedConfiguration config)
        {
            Guard.Argument(dataPoster, nameof(dataPoster)).NotNull();
            Guard.Argument(sequenceGenerator, nameof(sequenceGenerator)).NotNull();
            Guard.Argument(config, nameof(config)).NotNull();

            _dataPoster        = dataPoster;
            _sequenceGenerator = sequenceGenerator;
            _nodeId            = config.NodeId;
        }
Ejemplo n.º 6
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="poster">A <see cref="IDataPoster" /> 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, IDataPoster poster, IDeserializer <TIn> deserializer, ISingleTypeMapperFactory <TIn, TOut> mapperFactory)
        {
            Guard.Argument(uriFormat, nameof(uriFormat)).NotNull().NotEmpty();
            Guard.Argument(fetcher, nameof(fetcher)).NotNull();
            Guard.Argument(poster, nameof(poster)).NotNull();
            Guard.Argument(deserializer, nameof(deserializer)).NotNull();
            Guard.Argument(mapperFactory, nameof(mapperFactory)).NotNull();

            _uriFormat     = uriFormat;
            _fetcher       = fetcher;
            _poster        = poster;
            _deserializer  = deserializer;
            _mapperFactory = mapperFactory;
        }