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 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); } }
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); } }
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)); }