예제 #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));
 }