public void CreateNew_AnotherConextExisted_CurrentPointsToTheNewContext() { OperationContext oldContext = GetNewTarget(); OperationContext newContext = OperationContext.CreateNew(); Assert.Same(OperationContext.Current, newContext); }
public void Dispose_OnNewContext_InnerContainerIsDisposed() { OperationContext context = OperationContext.CreateNew(); context.Dispose(); Assert.True(this.lastChildContainer.Disposed); }
public IDependencyScope BeginScope() { OperationContext context = OperationContext.CreateNew(); return(new DependencyScope(context) { Logger = Logger }); }
public void ServiceLocator_NewContextCreatedOnExistentOne_DifferentServiceLocatorInstance() { OperationContext context1 = GetNewTarget(); IServiceLocator serviceLocator1 = context1.ServiceLocator; OperationContext context2 = OperationContext.CreateNew(); IServiceLocator serviceLocator2 = context2.ServiceLocator; Assert.NotSame(serviceLocator1, serviceLocator2); }
public void CreateNew_AnotherConextExisted_OldContextDisposed() { OperationContext oldContext = GetNewTarget(); Disposable disposable = new Disposable(); oldContext.Items.Add("key", disposable); OperationContext.CreateNew(); Assert.True(disposable.IsDisposed); }
private static OperationContext GetNewTarget() { return(OperationContext.CreateNew()); }
public void CreateNew_AfterCalled_ContainerAsChildOfTheGlobalContainer() { OperationContext.CreateNew(); Assert.Same(ContextManager.GlobalContainer, this.lastChildContainer.Parent); }