public void ShouldCohexistSeveralInstancesWithDifferentViewsInDifferentExecutionContexts() { Nails.Reset(false); Nails.Configure() .IoC.Container <NailsFramework.IoC.Spring>() .Lemming <TestSingletonPresenter>() .Lemming <SwitcheableExcecutionContext>() .UserInterface.Platform <NullMvp>() .Initialize(); var context = Nails.ObjectFactory.GetObject <SwitcheableExcecutionContext>(); var view1 = new TestSingletonView(); var view2 = new TestSingletonView(); context.SwitchToA(); var presenter1 = PresenterProvider.GetFor(view1); context.SwitchToB(); var presenter2 = PresenterProvider.GetFor(view2); Assert.AreSame(presenter1, presenter2); context.SwitchToA(); Assert.AreEqual(presenter1.GetView(), view1); context.SwitchToB(); Assert.AreEqual(presenter2.GetView(), view2); }
public ReferenceResolver AcquireConfiguration(NailsTestsConfigurable test) { rwLock.AcquireReaderLock(ConfigurationTimeout); var testConfigurationName = test.ConfigurationName; if (currentConfigurationName != testConfigurationName) { var lockCookie = rwLock.UpgradeToWriterLock(ConfigurationTimeout); try { var configurationDelegate = NailsTestsConfigurationRepository.Instance.Get(testConfigurationName); Nails.Reset(); configurationDelegate(Nails.Configure().UnitOfWork.ConnectionBoundUnitOfWork(false)); currentReferenceResolver = new ReferenceResolver(Nails.ObjectFactory); currentConfigurationName = testConfigurationName; } finally { rwLock.DowngradeFromWriterLock(ref lockCookie); } } return(currentReferenceResolver); }
public void Reset() { Nails.Reset(false); if (UseTestContext) { Nails.Configure().IoC.Lemming <TestExecutionContext>(); } }
public void SetUp() { Nails.Reset(false); Nails.Configure() .IoC.Container <NailsFramework.IoC.Spring>() .Initialize(); sessionContext = Nails.ObjectFactory.GetObject <ISessionContext>(); }
public virtual void SetUp() { if (!configured) { Nails.Reset(); ConfigureNails(Nails.Configure().UnitOfWork.ConnectionBoundUnitOfWork(false)); referenceResolver = new ReferenceResolver(Nails.ObjectFactory); } InjectTestProperties(); configured = true; PersistenceContext.OpenSession(); if (TestsInUnitOfWork) { uow = WorkContextProvider.CurrentContext.BeginUnitOfWork(new UnitOfWorkInfo(true)); } }
public void SetUp() { Nails.Reset(false); }