public void MarketDescriptionIsObtainedTest() { const int marketId = 447; var mdCache = (MarketDescriptionCache)_marketDescriptionCache; var marketDescription = _marketDescriptionCache.GetMarketDescriptorAsync(marketId, null, _cultures).Result; Assert.IsTrue(mdCache.Cache.GetCount() > 0); Assert.IsNotNull(marketDescription); Assert.AreEqual(marketId, marketDescription.Id); }
/// <summary> /// Asynchronously gets a <see cref="MarketDescriptionCacheItem" /> instance for the market specified by <code>id</code> and <code>specifiers</code> /// </summary> /// <param name="marketId">The market identifier</param> /// <param name="variant">A <see cref="string" /> specifying market selectionId or a null reference if market is invariant</param> /// <returns>A <see cref="Task{T}" /> representing the async retrieval operation</returns> /// <exception cref="CacheItemNotFoundException">The requested key was not found in the cache and could not be loaded</exception> public async Task <MarketDescriptionCacheItem> GetMarketDescriptorAsync(int marketId, string variant) { if (MarketDescriptionCache == null) { throw new CommunicationException("No AccessToken provided.", null, null); } var cacheItem = await MarketDescriptionCache.GetMarketDescriptorAsync(marketId, variant, _cultures).ConfigureAwait(false); if (cacheItem == null) { ExecutionLog.Warn($"No MarketDescription found for marketId {marketId}."); } return(cacheItem); }