Example #1
0
        public void Init()
        {
            _cacheManager      = new CacheManager();
            _dataRouterManager = new TestDataRouterManager(_cacheManager);

            _variantMemoryCache             = new MemoryCache("VariantCache");
            _invariantMemoryCache           = new MemoryCache("InVariantCache");
            _variantDescriptionsMemoryCache = new MemoryCache("VariantDescriptionListCache");

            _timer = new SdkTimer(_timerInterval, _timerInterval);
            _mappingValidatorFactory     = new MappingValidatorFactory();
            _inVariantMdCache            = new InvariantMarketDescriptionCache(_invariantMemoryCache, _dataRouterManager, _mappingValidatorFactory, _timer, TestData.Cultures, _cacheManager);
            _variantMdCache              = new VariantMarketDescriptionCache(_variantMemoryCache, _dataRouterManager, _mappingValidatorFactory, _cacheManager);
            _variantDescriptionListCache = new VariantDescriptionListCache(_variantDescriptionsMemoryCache, _dataRouterManager, _mappingValidatorFactory, _timer, TestData.Cultures, _cacheManager);

            var dataFetcher = new TestDataFetcher();

            var betStopReasonsCache = new NamedValueCache(new NamedValueDataProvider(FileHelper.FindFile("betstop_reasons.xml"), dataFetcher, "betstop_reason"), ExceptionHandlingStrategy.THROW);

            var bettingStatusCache = new NamedValueCache(new NamedValueDataProvider(FileHelper.FindFile("betting_status.xml"), dataFetcher, "betting_status"),
                                                         ExceptionHandlingStrategy.THROW);

            var namedValueProviderMock = new Mock <INamedValuesProvider>();

            namedValueProviderMock.Setup(x => x.BetStopReasons).Returns(betStopReasonsCache);
            namedValueProviderMock.Setup(x => x.BettingStatuses).Returns(bettingStatusCache);

            _validator = new FeedMessageValidator(
                new MarketCacheProvider(_inVariantMdCache, _variantMdCache, _variantDescriptionListCache),
                TestData.Culture,
                namedValueProviderMock.Object,
                TestProducerManager.Create());
        }
Example #2
0
        private void Setup(ExceptionHandlingStrategy exceptionStrategy)
        {
            var dataFetcher = new TestDataFetcher();

            _fetcherMock = new Mock <IDataFetcher>();

            _betStopReasonsUri = new Uri(TestData.RestXmlPath + @"\betstop_reasons.xml", UriKind.Absolute);
            _fetcherMock.Setup(args => args.GetDataAsync(_betStopReasonsUri))
            .Returns(dataFetcher.GetDataAsync(_betStopReasonsUri));

            var uriFormat = TestData.RestXmlPath + @"\betstop_reasons.xml";

            _cache = new NamedValueCache(new NamedValueDataProvider(uriFormat, _fetcherMock.Object, "betstop_reason"),
                                         exceptionStrategy);
        }
        static MapEntityTestBase()
        {
            var nameProviderFactoryMock = new Mock <INameProviderFactory>();
            var nameProviderMock        = new Mock <INameProvider>();

            nameProviderFactoryMock.Setup(m => m.BuildNameProvider(It.IsAny <ICompetition>(), It.IsAny <int>(), It.IsAny <IReadOnlyDictionary <string, string> >())).Returns(nameProviderMock.Object);

            var voidReasonCache = new NamedValueCache(new NamedValueDataProvider(TestData.RestXmlPath + @"\void_reasons.xml", new TestDataFetcher(), "void_reason"), ExceptionHandlingStrategy.THROW);

            var namedValuesProviderMock = new Mock <INamedValuesProvider>();

            namedValuesProviderMock.Setup(x => x.VoidReasons).Returns(voidReasonCache);

            Mapper = new FeedMessageMapper(
                new TestSportEventFactory(),
                nameProviderFactoryMock.Object,
                new Mock <IMarketMappingProviderFactory>().Object,
                namedValuesProviderMock.Object,
                ExceptionHandlingStrategy.THROW,
                TestProducerManager.Create(),
                new Mock <IMarketCacheProvider>().Object,
                voidReasonCache);
        }