public async Task ItemLookupsArePresentAndMatchExpectedCount(TypeOfListItemLookup thisKey, int expectedCount) { // arrange var internalDataCache = new InternalDataCache(); // act await NewService(internalDataCache).PopulateAsync(CancellationToken.None); Assert.True(internalDataCache.ListItemLookups.ContainsKey(thisKey)); Assert.Equal(expectedCount, internalDataCache.ListItemLookups[thisKey].Count); }
/// <summary> /// Adds lookups. /// </summary> /// <param name="forThisKey">For this key.</param> /// <param name="usingSource">using source.</param> /// <param name="addToCache">add to cache.</param> public void AddLookups(TypeOfListItemLookup forThisKey, XElement usingSource, InternalDataCache addToCache) { var lookups = BuildStringDictionaryLookups(usingSource, $"{forThisKey}"); addToCache.ListItemLookups.Add(forThisKey, lookups); }
public bool Contains(TypeOfListItemLookup lookupKey, string keyCandidate, string valueCandidate) { return(!string.IsNullOrEmpty(keyCandidate) && _internalCache.ListItemLookups[lookupKey].TryGetValue(keyCandidate, out var value) && value.Contains(valueCandidate)); }