Esempio n. 1
0
        public void AbortShouldThrowObjectDisposed()
        {
            // Arrange
            TestTrace.Arrange();
            var activity = new Sequence();
            var workflow = new WorkflowP1(activity);

            try
            {
                // Act
                TestTrace.Act();
                workflow.Dispose();

                // Assert
                TestTrace.Assert();
                AssertHelper.Throws<ObjectDisposedException>(() => workflow.Abort());
            }
            finally
            {
                TestTrace.Finally();

                // Trace things here
            }
        }
Esempio n. 2
0
        public void TraceOptionsSetShouldThrowObjectDisposed()
        {
            // Arrange
            TestTrace.Arrange();
            var activity = new Sequence();
            var workflow = new WorkflowP1(activity);
            workflow.RunAsync().Wait();

            try
            {
                // Act
                TestTrace.Act();
                workflow.Dispose();

                // Assert
                TestTrace.Assert();
                AssertHelper.Throws<ObjectDisposedException>(() => workflow.TraceOptions = WorkflowTraceOptions.Debug);
            }
            finally
            {
                TestTrace.Finally();

                // Trace things here
            }
        }
Esempio n. 3
0
        public void RunShouldThrowIfDisposed()
        {
            // Arrange
            TestTrace.Arrange();
            var activity = new Sequence();
            using (var workflow = new WorkflowP1(activity) { Timeout = Constants.Timeout })
            {
                Exception exception = null;
                try
                {
                    // Act
                    TestTrace.Act();
                    workflow.Dispose();

                    // ReSharper disable AccessToDisposedClosure
                    // Testing dispose behavior
                    exception = AssertHelper.Throws<ObjectDisposedException>(() => workflow.RunAsync().Wait());

                    // ReSharper restore AccessToDisposedClosure

                    // Assert
                    TestTrace.Assert();
                }
                finally
                {
                    TestTrace.Finally();
                    exception.Trace();
                }
            }
        }
Esempio n. 4
0
        public void ResumeAsyncWithTokenShouldThrowObjectDisposed()
        {
            // Arrange
            TestTrace.Arrange();
            var activity = new Sequence();
            var workflow = new WorkflowP1(activity);
            workflow.RunAsync().Wait();

            try
            {
                // Act
                TestTrace.Act();
                workflow.Dispose();

                // Assert
                TestTrace.Assert();
                AssertHelper.Throws<ObjectDisposedException>(() => workflow.ResumeAsync("Foo").Wait());
            }
            finally
            {
                TestTrace.Finally();

                // Trace things here
            }
        }
Esempio n. 5
0
        public void PersistableIdleGetShouldThrowObjectDisposed()
        {
            // Arrange
            TestTrace.Arrange();
            var activity = new Sequence();
            var workflow = new WorkflowP1(activity);
            workflow.RunAsync().Wait();

            try
            {
                // Act
                TestTrace.Act();
                workflow.Dispose();

                // Assert
                TestTrace.Assert();
                AssertHelper.Throws<ObjectDisposedException>(() => AssertHelper.GetProperty(workflow.PersistableIdle));
            }
            finally
            {
                TestTrace.Finally();

                // Trace things here
            }
        }