private static void ValidateOutcome(desc_outcomesOutcome msg, MarketOutcomeCacheItem ci, CultureInfo culture) { Assert.AreEqual(msg.id, ci.Id); Assert.AreEqual(msg.name, ci.GetName(culture)); Assert.AreEqual(msg.description, ci.GetDescription(culture)); }
internal OutcomeDescription(MarketOutcomeCacheItem cacheItem, IEnumerable <CultureInfo> cultures) { Contract.Requires(cacheItem != null); Contract.Requires(cultures != null && cultures.Any()); var cultureList = cultures as List <CultureInfo> ?? cultures.ToList(); Id = cacheItem.Id; _names = new ReadOnlyDictionary <CultureInfo, string>(cultureList.ToDictionary(culture => culture, cacheItem.GetName)); _descriptions = new ReadOnlyDictionary <CultureInfo, string>(cultureList.Where(c => !string.IsNullOrEmpty(cacheItem.GetDescription(c))).ToDictionary(c => c, cacheItem.GetDescription)); }
internal OutcomeDescription(MarketOutcomeCacheItem cacheItem, IEnumerable <CultureInfo> cultures) { Guard.Argument(cacheItem, nameof(cacheItem)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull().NotEmpty(); var cultureList = cultures as List <CultureInfo> ?? cultures.ToList(); Id = cacheItem.Id; _names = new ReadOnlyDictionary <CultureInfo, string>(cultureList.ToDictionary(culture => culture, cacheItem.GetName)); _descriptions = new ReadOnlyDictionary <CultureInfo, string>(cultureList.Where(c => !string.IsNullOrEmpty(cacheItem.GetDescription(c))).ToDictionary(c => c, cacheItem.GetDescription)); }