예제 #1
0
        public static void Init(TestContext context)
        {
            IUnityContainer container = new UnityContainer().EnableDiagnostic();
            var             config    = TestConfigurationInternal.GetConfig();

            _dispatcher = new Mock <IGlobalEventDispatcher>().Object;

            container.RegisterBaseTypes(config, null, null);

            // we need to override initial loading of bookmaker details and producers
            var bookmakerDetailsProviderMock = new Mock <BookmakerDetailsProvider>("bookmakerDetailsUriFormat",
                                                                                   new TestDataFetcher(),
                                                                                   new Deserializer <bookmaker_details>(),
                                                                                   new BookmakerDetailsMapperFactory());

            bookmakerDetailsProviderMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(TestConfigurationInternal.GetBookmakerDetails());
            var defaultBookmakerDetailsProvider = bookmakerDetailsProviderMock.Object;

            container.RegisterInstance <IDataProvider <BookmakerDetailsDTO> >(defaultBookmakerDetailsProvider, new ContainerControlledLifetimeManager());
            container.RegisterInstance <BookmakerDetailsProvider>(defaultBookmakerDetailsProvider, new ContainerControlledLifetimeManager());

            var newConfig = new OddsFeedConfigurationInternal(config, defaultBookmakerDetailsProvider);

            newConfig.Load();
            container.RegisterInstance <IOddsFeedConfiguration>(newConfig, new ContainerControlledLifetimeManager());
            container.RegisterInstance <IOddsFeedConfigurationInternal>(newConfig, new ContainerControlledLifetimeManager());

            container.RegisterTypes(_dispatcher, config);

            //override
            container.RegisterType <IProducerManager, ProducerManager>(new ContainerControlledLifetimeManager(), new InjectionConstructor(new TestProducersProvider(), config));

            container.RegisterAdditionalTypes();

            _childContainer1 = container.CreateChildContainer();
            _childContainer2 = container.CreateChildContainer();
        }
        public void virtual_host_has_correct_value()
        {
            var publicConfig = new TokenSetter(new TestSectionProvider(null))
                              .SetAccessToken(TestData.AccessToken)
                              .SelectIntegration()
                              .SetDefaultLanguage(TestData.Culture)
                              .Build();

            var internalConfig = new OddsFeedConfigurationInternal(publicConfig, _defaultBookmakerDetailsProvider);
            internalConfig.Load();
            Assert.AreEqual(TestConfigurationInternal.GetBookmakerDetails().VirtualHost, internalConfig.VirtualHost);

            publicConfig = new TokenSetter(new TestSectionProvider(null))
                          .SetAccessToken(TestData.AccessToken)
                          .SelectCustom()
                          .SetVirtualHost("virtual_host")
                          .SetDefaultLanguage(TestData.Culture)
                          .SetMessagingHost(_testSection.Host)
                          .SetApiHost(_testSection.ApiHost)
                          .Build();
            internalConfig = new OddsFeedConfigurationInternal(publicConfig, _defaultBookmakerDetailsProvider);
            internalConfig.Load();
            Assert.AreEqual(publicConfig.VirtualHost, internalConfig.VirtualHost);
        }
예제 #3
0
        /// <inheritdoc />
        public TestFeed(IDataRouterManager dataRouterManager, IProducersProvider producersProvider, IOddsFeedConfiguration config, ILoggerFactory loggerFactory = null, IMetricsRoot metricsRoot = null)
            : base(config, loggerFactory, metricsRoot)
        {
            var bookmakerDetailsProviderMock = new Mock <BookmakerDetailsProvider>("bookmakerDetailsUriFormat",
                                                                                   new TestDataFetcher(),
                                                                                   new Deserializer <bookmaker_details>(),
                                                                                   new BookmakerDetailsMapperFactory());

            bookmakerDetailsProviderMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(TestConfigurationInternal.GetBookmakerDetails());
            var defaultBookmakerDetailsProvider = bookmakerDetailsProviderMock.Object;

            InternalConfig = new OddsFeedConfigurationInternal(config, defaultBookmakerDetailsProvider);

            DataRouterManager = dataRouterManager;
            ProducersProvider = producersProvider;

            RecoveryDataPoster = new TestDataFetcher();
        }
        public void MarketDescriptionManagerInitTest()
        {
            var marketDescriptionManager = new MarketDescriptionManager(TestConfigurationInternal.GetConfig(), _marketCacheProvider, _invariantMarketDescriptionCache, _variantDescriptionListCache, _variantMarketDescriptionCache);

            Assert.IsNotNull(marketDescriptionManager);
        }
예제 #5
0
        public void Setup()
        {
            _testSection = TestSection.Create();
            var bookmakerDetailsProviderMock = new Mock <BookmakerDetailsProvider>("bookmakerDetailsUriFormat",
                                                                                   new TestDataFetcher(),
                                                                                   new Deserializer <bookmaker_details>(),
                                                                                   new BookmakerDetailsMapperFactory());

            bookmakerDetailsProviderMock.Setup(x => x.GetData(It.IsAny <string>())).Returns(TestConfigurationInternal.GetBookmakerDetails());
            _defaultBookmakerDetailsProvider = bookmakerDetailsProviderMock.Object;
        }
        public static void Init(TestContext context)
        {
            var config = TestConfigurationInternal.GetConfig();

            _validator = new ConnectionValidator(config, new HttpDataFetcher(new HttpClient(), TestData.AccessToken, new Deserializer <response>()));
        }