Esempio n. 1
0
        public void CreateNew_AnotherConextExisted_CurrentPointsToTheNewContext()
        {
            OperationContext oldContext = GetNewTarget();

            OperationContext newContext = OperationContext.CreateNew();

            Assert.Same(OperationContext.Current, newContext);
        }
Esempio n. 2
0
        public void Dispose_OnNewContext_InnerContainerIsDisposed()
        {
            OperationContext context = OperationContext.CreateNew();

            context.Dispose();

            Assert.True(this.lastChildContainer.Disposed);
        }
Esempio n. 3
0
        public IDependencyScope BeginScope()
        {
            OperationContext context = OperationContext.CreateNew();

            return(new DependencyScope(context)
            {
                Logger = Logger
            });
        }
Esempio n. 4
0
        public void ServiceLocator_NewContextCreatedOnExistentOne_DifferentServiceLocatorInstance()
        {
            OperationContext context1        = GetNewTarget();
            IServiceLocator  serviceLocator1 = context1.ServiceLocator;

            OperationContext context2        = OperationContext.CreateNew();
            IServiceLocator  serviceLocator2 = context2.ServiceLocator;

            Assert.NotSame(serviceLocator1, serviceLocator2);
        }
Esempio n. 5
0
        public void CreateNew_AnotherConextExisted_OldContextDisposed()
        {
            OperationContext oldContext = GetNewTarget();
            Disposable       disposable = new Disposable();

            oldContext.Items.Add("key", disposable);

            OperationContext.CreateNew();

            Assert.True(disposable.IsDisposed);
        }
Esempio n. 6
0
 private static OperationContext GetNewTarget()
 {
     return(OperationContext.CreateNew());
 }
Esempio n. 7
0
        public void CreateNew_AfterCalled_ContainerAsChildOfTheGlobalContainer()
        {
            OperationContext.CreateNew();

            Assert.Same(ContextManager.GlobalContainer, this.lastChildContainer.Parent);
        }