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

            OperationContext newContext = OperationContext.CreateNew();

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

            context.Dispose();

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

            return(new DependencyScope(context)
            {
                Logger = Logger
            });
        }
Exemplo 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);
        }
Exemplo 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);
        }
Exemplo n.º 6
0
 private static OperationContext GetNewTarget()
 {
     return(OperationContext.CreateNew());
 }
Exemplo n.º 7
0
        public void CreateNew_AfterCalled_ContainerAsChildOfTheGlobalContainer()
        {
            OperationContext.CreateNew();

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