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 } }
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 } }
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(); } } }
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 } }
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 } }