System.Threading.Tests.ExecutionContextTests.CreateCopyTest C# (CSharp) Method

CreateCopyTest() private method

private CreateCopyTest ( ) : void
return void
        public static void CreateCopyTest()
        {
            ThreadTestHelpers.RunTestInBackgroundThread(() =>
            {
                var asyncLocal = new AsyncLocal<int>();
                ExecutionContext executionContext = ExecutionContext.Capture();
                VerifyExecutionContext(executionContext, asyncLocal, 0);
                executionContext = ExecutionContext.Capture();
                ExecutionContext executionContextCopy0 = executionContext.CreateCopy();
                asyncLocal.Value = 1;
                executionContext = ExecutionContext.Capture();
                VerifyExecutionContext(executionContext, asyncLocal, 1);
                VerifyExecutionContext(executionContextCopy0, asyncLocal, 0);
                executionContext = ExecutionContext.Capture();
                ExecutionContext executionContextCopy1 = executionContext.CreateCopy();
                VerifyExecutionContext(executionContextCopy1, asyncLocal, 1);
            });
        }