Esempio n. 1
0
        public void SameSingletonIsReturnedOnSecondResponse()
        {
            SingletonProvider singletonProvider = new SingletonProvider(typeof(Clazz), injector);
            object            returnedResponse  = singletonProvider.Apply(null, injector, null);
            object            secondResponse    = singletonProvider.Apply(null, injector, null);

            Assert.AreEqual(returnedResponse, secondResponse);
        }
Esempio n. 2
0
        public void usingDestroyedSingletonProviderThrows()
        {
            SingletonProvider provider = new SingletonProvider(typeof(Clazz), injector);

            provider.Destroy();
            provider.Apply(null, injector, null);
        }
Esempio n. 3
0
        public void SingletonProviderReturnsInstance()
        {
            SingletonProvider singletonProvider = new SingletonProvider(typeof(Clazz), injector);
            object            returnedResponse  = singletonProvider.Apply(null, injector, null);

            Assert.IsInstanceOf <Clazz>(returnedResponse);
        }
Esempio n. 4
0
        public void DestroyingSingletonProviderInvokesPreDestroyMethodsOnSingleton()
        {
            SingletonProvider provider  = new SingletonProvider(typeof(Clazz), injector);
            Clazz             singleton = provider.Apply(null, injector, null) as Clazz;

            provider.Destroy();
            Assert.True(singleton.preDestroyCalled);
        }