Beispiel #1
0
 private T RetrieveOrCreateFunction <T>(Type type) where T : class
 {
     CodeIsUnderTest = true;
     if (!ActiveFakes.ContainsKey(type))
     {
         ActiveFakes.Add(type, (StubBase)Activator.CreateInstance(type));
     }
     return(ActiveFakes[type] as T);
 }
Beispiel #2
0
        private T RetrieveOrCreateFunction <T>(Func <T> factory)
            where T : StubBase
        {
            var type = typeof(T);

            CodeIsUnderTest = true;
            if (!ActiveFakes.ContainsKey(type))
            {
                ActiveFakes.Add(type, factory.Invoke());
            }

            return(ActiveFakes[type] as T);
        }