private void Setup(ExceptionHandlingStrategy exceptionStrategy) { var dataFetcher = new TestDataFetcher(); _fetcherMock = new Mock <IDataFetcher>(); _enMatchStatusUri = new Uri(TestData.RestXmlPath + @"\match_status_descriptions.en.xml", UriKind.Absolute); _fetcherMock.Setup(args => args.GetDataAsync(_enMatchStatusUri)) .Returns(dataFetcher.GetDataAsync(_enMatchStatusUri)); _deMatchStatusUri = new Uri(TestData.RestXmlPath + @"\match_status_descriptions.de.xml", UriKind.Absolute); _fetcherMock.Setup(args => args.GetDataAsync(_deMatchStatusUri)) .Returns(dataFetcher.GetDataAsync(_deMatchStatusUri)); _huMatchStatusUri = new Uri(TestData.RestXmlPath + @"\match_status_descriptions.hu.xml", UriKind.Absolute); _fetcherMock.Setup(args => args.GetDataAsync(_huMatchStatusUri)) .Returns(dataFetcher.GetDataAsync(_huMatchStatusUri)); _nlMatchStatusUri = new Uri(TestData.RestXmlPath + @"\match_status_descriptions.nl.xml", UriKind.Absolute); _fetcherMock.Setup(args => args.GetDataAsync(_nlMatchStatusUri)) .Returns(dataFetcher.GetDataAsync(_nlMatchStatusUri)); var uriFormat = TestData.RestXmlPath + @"\match_status_descriptions.{0}.xml"; _cache = new LocalizedNamedValueCache(new NamedValueDataProvider(uriFormat, _fetcherMock.Object, "match_status"), new[] { new CultureInfo("en"), new CultureInfo("de"), new CultureInfo("hu") }, exceptionStrategy); }
public void Init() { _memoryCache = new MemoryCache("sportEventCache"); _cacheManager = new CacheManager(); _dataRouterManager = new TestDataRouterManager(_cacheManager); _timer = new TestTimer(false); _sportEventCache = new SportEventCache(_memoryCache, _dataRouterManager, new SportEventCacheItemFactory(_dataRouterManager, new SemaphorePool(5, ExceptionHandlingStrategy.THROW), TestData.Cultures.First(), new MemoryCache("FixtureTimestampCache")), _timer, TestData.Cultures3, _cacheManager); var deserializer = new Deserializer <tournamentInfoEndpoint>(); var dataFetcher = new TestDataFetcher(); var mapperFactory = new TournamentInfoMapperFactory(); var tourDataProvider = new DataProvider <tournamentInfoEndpoint, TournamentInfoDTO>(TestData.RestXmlPath + TourInfoXml, dataFetcher, deserializer, mapperFactory); _tourApiData = deserializer.Deserialize(dataFetcher.GetData(new Uri(string.Format(TestData.RestXmlPath + TourInfoXml)))); _tourDtoData = tourDataProvider.GetDataAsync("", "en").Result; _tourCiData = (TournamentInfoCI)_sportEventCache.GetEventCacheItem(URN.Parse("sr:tournament:40")); var seasonDataProvider = new DataProvider <tournamentInfoEndpoint, TournamentInfoDTO>(TestData.RestXmlPath + SeasonInfoXml, dataFetcher, deserializer, mapperFactory); _seasonApiData = deserializer.Deserialize(dataFetcher.GetData(new Uri(string.Format(TestData.RestXmlPath + SeasonInfoXml)))); _seasonDtoData = seasonDataProvider.GetDataAsync("", "en").Result; _seasonCiData = (TournamentInfoCI)_sportEventCache.GetEventCacheItem(URN.Parse("sr:season:80242")); }
public void Init() { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; var config = TestConfigurationInternal.GetConfig(); object[] args = { new HttpClient(), config.AccessToken, new Deserializer <response>(), 5, 15 }; //_httpDataRestful = LogInterceptorFactory.Create<HttpDataRestful>(args, null, LoggerType.RestTraffic); //_httpDataRestful = LogInterceptorFactory.Create<TestDataFetcher>(args, null, LoggerType.RestTraffic); _httpDataRestful = new TestDataFetcher(); object[] args2 = { "https://stgapi.betradar.com/v1/replay", _httpDataRestful, 0 }; _replayManager = LogInterceptorFactory.Create <ReplayManager>(args2, m => m.Name.Contains("Async"), LoggerType.RestTraffic); }
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()); }
public void Init() { var deserializer = new Deserializer <tournamentInfoEndpoint>(); var dataFetcher = new TestDataFetcher(); var mapperFactory = new TournamentInfoMapperFactory(); var dataProvider = new DataProvider <tournamentInfoEndpoint, TournamentInfoDTO>( TestData.RestXmlPath + TourInfoXml, dataFetcher, deserializer, mapperFactory); _entity = dataProvider.GetDataAsync("", "en").Result; }
public static void Init(TestContext context) { var deserializer = new Deserializer <tournamentsEndpoint>(); var dataFetcher = new TestDataFetcher(); var mapperFactory = new TournamentsMapperFactory(); var dataProvider = new DataProvider <tournamentsEndpoint, EntityList <SportDTO> >( TestData.RestXmlPath + InputXml, dataFetcher, deserializer, mapperFactory); _entity = dataProvider.GetDataAsync("", "en").Result; }
public static void Init(TestContext context) { var deserializer = new Deserializer <market_descriptions>(); var dataFetcher = new TestDataFetcher(); var mapperFactory = new MarketDescriptionsMapperFactory(); var dataProvider = new DataProvider <market_descriptions, EntityList <MarketDescriptionDTO> >( TestData.RestXmlPath + InputXml, dataFetcher, deserializer, mapperFactory); _entity = dataProvider.GetDataAsync("", "en").Result; }
private void InitSportEventCache() { var testDataFetcher = new TestDataFetcher(); _eventCache = new MemoryCache("test"); var fixtureDeserializer = new Deserializer <fixturesEndpoint>(); var fixtureMapperFactory = new FixtureMapperFactory(); var fixtureProvider = new DataProvider <fixturesEndpoint, FixtureDTO>( DirPath + FixtureXml, testDataFetcher, fixtureDeserializer, fixtureMapperFactory); var dateDeserializer = new Deserializer <scheduleEndpoint>(); var dateMapperFactory = new SportEventsScheduleMapperFactory(); var dateProvider = new DateScheduleProvider( DirPath + ScheduleXml, DirPath + ScheduleXml, testDataFetcher, dateDeserializer, dateMapperFactory); // tournament schedule provider var tourDeserializer = new Deserializer <tournamentScheduleEndpoint>(); var tourMapperFactory = new TournamentScheduleMapperFactory(); var tourProvider = new DataProvider <tournamentScheduleEndpoint, EntityList <MatchSummaryDTO> >( DirPath + TourXml, testDataFetcher, tourDeserializer, tourMapperFactory); var detailsDeserializer = new Deserializer <matchSummaryEndpoint>(); var detailsMapperFactory = new SportEventDetailsMapperFactory(); var eventDetailsProvider = new DataProvider <matchSummaryEndpoint, SportEventDetailsDTO>( DirPath + DetailsXml, testDataFetcher, detailsDeserializer, detailsMapperFactory); var timer = new TestTimer(false); _sportEventCacheItemFactory = new SportEventCacheItemFactory(fixtureProvider, eventDetailsProvider, DefaultCulture); _sportEventCache = new SportEventCache(_eventCache, dateProvider, tourProvider, _sportEventCacheItemFactory, timer, Cultures); }
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); }
/// <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 Init() { var deserializer = new Deserializer <bookmaker_details>(); var dataFetcher = new TestDataFetcher(); var mapperFactory = new BookmakerDetailsMapperFactory(); var dataProvider = new DataProvider <bookmaker_details, BookmakerDetailsDTO>( TestData.RestXmlPath + InputXml, dataFetcher, deserializer, mapperFactory); _entity = dataProvider.GetDataAsync("", TestData.Culture.TwoLetterISOLanguageName).Result; object[] args = { dataProvider }; _bookmakerDetailsFetcher = LogInterceptorFactory.Create <BookmakerDetailsFetcher>(args, null, LoggerType.ClientInteraction); }