예제 #1
0
        public async Task CodedLookupsArePresentAndMatchExpectedCount(TypeOfStringCodedLookup thisKey, int expectedCount)
        {
            // arrange
            var internalDataCache = new InternalDataCache();

            // act
            await NewService(internalDataCache).PopulateAsync(CancellationToken.None);

            // assert
            Assert.True(internalDataCache.StringLookups.ContainsKey(thisKey));
            Assert.Equal(expectedCount, internalDataCache.StringLookups[thisKey].Count);
        }
예제 #2
0
        public void TypeOfStringCodedLookupMeetsCasingExpectation(TypeOfStringCodedLookup thisKey, string candidate)
        {
            // arrange
            var sut   = NewService();
            var cache = sut.Create();

            // act
            var result = cache.StringLookups[thisKey].Contains(candidate);

            // assert
            Assert.True(result);
        }
        /// <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(TypeOfStringCodedLookup forThisKey, XElement usingSource, InternalDataCache addToCache)
        {
            var lookups = BuildStringListLookups(usingSource, $"{forThisKey}");

            addToCache.StringLookups.Add(forThisKey, lookups);
        }
예제 #4
0
 public bool Contains(TypeOfStringCodedLookup lookupKey, string candidate)
 {
     return(!string.IsNullOrWhiteSpace(candidate) &&
            _internalCache.StringLookups[lookupKey].Contains(candidate));
 }
예제 #5
0
 public IReadOnlyCollection <string> Get(TypeOfStringCodedLookup lookupKey) =>
 _internalCache.StringLookups[lookupKey];
예제 #6
0
 /// <summary>
 /// Determines whether [the specified lookup key] [contains] the value.
 /// </summary>
 /// <param name="lookupKey">The lookup key.</param>
 /// <param name="candidate">The candidate.</param>
 /// <returns>
 /// <c>true</c> if [the specified lookup] [contains]; otherwise, <c>false</c>.
 /// </returns>
 public bool Contains(TypeOfStringCodedLookup lookupKey, string candidate)
 {
     return(It.Has(candidate) &&
            InternalCache.StringLookups[lookupKey].Contains(candidate));
 }