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); }
public void usingDestroyedSingletonProviderThrows() { SingletonProvider provider = new SingletonProvider(typeof(Clazz), injector); provider.Destroy(); provider.Apply(null, injector, null); }
public void SingletonProviderReturnsInstance() { SingletonProvider singletonProvider = new SingletonProvider(typeof(Clazz), injector); object returnedResponse = singletonProvider.Apply(null, injector, null); Assert.IsInstanceOf <Clazz>(returnedResponse); }
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); }