public void GetOrCreateValue_Get()
        {
            bool delegateCalled = false;

            Assert.That(_store.GetOrCreateValue("a", delegate { delegateCalled = true; return(7); }), Is.EqualTo(1));
            Assert.That(delegateCalled, Is.False);
        }
示例#2
0
        public TValue GetOrCreateValue(TKey key, Func <TKey, TValue> valueFactory)
        {
            ArgumentUtility.DebugCheckNotNull("key", key);
            ArgumentUtility.DebugCheckNotNull("valueFactory", valueFactory);

            return(_dataStore.GetOrCreateValue(key, valueFactory));
        }
 public virtual T GetCloneFor <T> (T domainObject)
     where T : DomainObject
 {
     return((T)_clones.GetOrCreateValue(domainObject, delegate(DomainObject cloneTemplate)
     {
         DomainObject clone = _cloner.CreateCloneHull(cloneTemplate);
         CloneHulls.Enqueue(Tuple.Create(cloneTemplate, clone));
         return clone;
     }));
 }