public void CachesApplicationContexts() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); fixtureInstance.SetUp(); Assert.IsNotNull(fixtureInstance.ApplicationContext); Assert.AreEqual(1, fixtureInstance.LoadCount); // context has been loaded Assert.IsTrue(fixtureInstance.HasCachedContext(TestAbstractDependencyInjectionSpringContextTests.CONFIGLOCATIONS)); fixtureInstance.TearDown(); TestAbstractDependencyInjectionSpringContextTests otherFixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); otherFixtureInstance.SetUp(); Assert.IsNotNull(otherFixtureInstance.ApplicationContext); Assert.AreEqual(0, otherFixtureInstance.LoadCount); // context was obtained from cache Assert.AreSame(fixtureInstance.ApplicationContext, otherFixtureInstance.ApplicationContext); otherFixtureInstance.SetDirty(); // purge cache and dispose cached instances Assert.IsFalse(fixtureInstance.HasCachedContext(TestAbstractDependencyInjectionSpringContextTests.CONFIGLOCATIONS)); otherFixtureInstance.TearDown(); otherFixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); otherFixtureInstance.SetUp(); Assert.IsNotNull(otherFixtureInstance.ApplicationContext); Assert.AreEqual(1, otherFixtureInstance.LoadCount); // context was reloaded because of SetDirty() above Assert.AreNotSame(fixtureInstance.ApplicationContext, otherFixtureInstance.ApplicationContext); otherFixtureInstance.TearDown(); }
public void RegistersWithContextRegistryByDefault() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); Assert.AreEqual(typeof(CallCountingTransactionManager), t); Assert.AreEqual(typeof(TestObject), t2); }
public void CachesApplicationContexts() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); fixtureInstance.TestInitialize(); Assert.IsNotNull(fixtureInstance.ApplicationContext); Assert.AreEqual(1, fixtureInstance.LoadCount); // context has been loaded Assert.IsTrue(fixtureInstance.HasCachedContext(TestAbstractDependencyInjectionSpringContextTests.CONFIGLOCATIONS)); fixtureInstance.TestCleanup(); TestAbstractDependencyInjectionSpringContextTests otherFixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); otherFixtureInstance.TestInitialize(); Assert.IsNotNull(otherFixtureInstance.ApplicationContext); Assert.AreEqual(0, otherFixtureInstance.LoadCount); // context was obtained from cache Assert.AreSame(fixtureInstance.ApplicationContext, otherFixtureInstance.ApplicationContext); otherFixtureInstance.SetDirty(); // purge cache and dispose cached instances Assert.IsFalse(fixtureInstance.HasCachedContext(TestAbstractDependencyInjectionSpringContextTests.CONFIGLOCATIONS)); otherFixtureInstance.TestCleanup(); otherFixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(false); otherFixtureInstance.TestInitialize(); Assert.IsNotNull(otherFixtureInstance.ApplicationContext); Assert.AreEqual(1, otherFixtureInstance.LoadCount); // context was reloaded because of SetDirty() above Assert.AreNotSame(fixtureInstance.ApplicationContext, otherFixtureInstance.ApplicationContext); otherFixtureInstance.TestCleanup(); }
public void DoesNotRegisterContextWithContextRegistry() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); fixtureInstance.RegisterContextWithContextRegistry = false; fixtureInstance.SetUp(); Assert.IsFalse( ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name) ); fixtureInstance.TearDown(); Assert.IsFalse( ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name) ); }
public void DoesNotRegisterContextWithContextRegistry() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); fixtureInstance.RegisterContextWithContextRegistry = false; fixtureInstance.TestInitialize(); Assert.IsFalse(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.TestCleanup(); Assert.IsFalse(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); }
public void UnregistersFromContextRegistryWhenDirty() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); fixtureInstance.SetUp(); Assert.IsTrue(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.TearDown(); Assert.IsTrue(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.SetUp(); Assert.IsTrue(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.SetDirty(); fixtureInstance.TearDown(); Assert.IsFalse(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); }
public void RegistersWithContextRegistryByDefault() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); }
public void UnregistersFromContextRegistryWhenDirty() { fixtureInstance = new TestAbstractDependencyInjectionSpringContextTests(); Assert.IsTrue(fixtureInstance.RegisterContextWithContextRegistry); fixtureInstance.TestInitialize(); Assert.IsTrue( ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name) ); fixtureInstance.TestCleanup(); Assert.IsTrue(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.TestInitialize(); Assert.IsTrue(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); fixtureInstance.SetDirty(); fixtureInstance.TestCleanup(); Assert.IsFalse(ContextRegistry.IsContextRegistered(fixtureInstance.ApplicationContext.Name)); }