Пример #1
0
        public void PrimedCacheShouldNotAttemptLookup()
        {
            int lookupCount = 0;

            using (var mapper =
                       new KeyMapper <int>(this.primedDictionary, x => { lookupCount++; return(0); }))
            {
                var key = mapper.Map("1234");

                Assert.Equal(1234, key);
                Assert.Equal(0, lookupCount);
            }
        }
Пример #2
0
        public void EmptyCacheShouldLookupFirstValue()
        {
            bool lookupCalled = false;

            using (var mapper =
                       new KeyMapper <int>(this.emptyDictionary, x => { lookupCalled = true; return(1234); }))
            {
                var key = mapper.Map("1234");

                Assert.Equal(1234, key);
                Assert.Equal(true, lookupCalled);
            }
        }
Пример #3
0
        public void EmptyCacheShouldLookupFirstValue()
        {
            bool lookupCalled = false;

            using (var mapper =
                new KeyMapper<int>(this.emptyDictionary, x => { lookupCalled = true; return 1234; }))
            {
                var key = mapper.Map("1234");

                Assert.Equal(1234, key);
                Assert.Equal(true, lookupCalled);
            }
        }
Пример #4
0
        public void PrimedCacheShouldNotAttemptLookup()
        {
            int lookupCount = 0;

            using (var mapper =
                new KeyMapper<int>(this.primedDictionary, x => { lookupCount++; return 0; }))
            {
                var key = mapper.Map("1234");

                Assert.Equal(1234, key);
                Assert.Equal(0, lookupCount);
            }
        }
 public static PersistedGrant ToModel(this PersistedGrantTblEntity entity)
 {
     return(KeyMapper.Map <PersistedGrant>(entity));
 }