System.Threading.Tests.HostExecutionContextTests.BasicTest C# (CSharp) Method

BasicTest() private method

private BasicTest ( ) : void
return void
        public static void BasicTest()
        {
            var hec = new TestHostExecutionContext();
            Assert.Null(hec.State);

            var obj = new object();
            hec = new TestHostExecutionContext(obj);
            Assert.Same(obj, hec.State);

            obj = new object();
            hec.State = obj;
            Assert.Same(obj, hec.State);
            Assert.NotNull(hec.CreateCopy());

            hec.State = null;
            Assert.Null(hec.State);
            Assert.NotNull(hec.CreateCopy());

            Assert.False(hec.DisposeTrueCalled);
            hec.Dispose();
            Assert.True(hec.DisposeTrueCalled);

            // Dispose(bool) is public
            new HostExecutionContext().Dispose(true);
        }
HostExecutionContextTests