Esempio n. 1
0
        public void SingletonsAreStored()
        {
            var registeredType = new RegisteredType(typeof(MockClass), LifeCycle.Singleton, Ctor, ctorParams);
            var myClass        = registeredType.CreateInstance();

            Assert.Equal(myClass, registeredType.Instance);
        }
Esempio n. 2
0
        public void TransientsAreNotStored()
        {
            var registeredType = new RegisteredType(typeof(MockClass), LifeCycle.Transient, Ctor, ctorParams);
            var myClass        = registeredType.CreateInstance();

            Assert.Null(registeredType.Instance);
        }
Esempio n. 3
0
 private object CreateInstance(RegisteredType registeredObj)
 {
     return(registeredObj.SingletonInstance ?? registeredObj.CreateInstance(ResolveConstructorParameters(registeredObj)));
 }