public void TestEndPropagation() { TestOperation operation1 = new TestOperation(); TestOperation operation2 = new TestOperation(); OperationQueue <TestOperation> testQueueOperation = new OperationQueue <TestOperation>( new TestOperation[] { operation1, operation2 } ); testQueueOperation.Start(); Assert.IsFalse(testQueueOperation.Ended); operation1.SetEnded(); Assert.IsFalse(testQueueOperation.Ended); operation2.SetEnded(); Assert.IsTrue(testQueueOperation.Ended); testQueueOperation.Join(); }
public void TestExceptionPropagation() { TestOperation operation1 = new TestOperation(); TestOperation operation2 = new TestOperation(); OperationQueue <TestOperation> testQueueOperation = new OperationQueue <TestOperation>( new TestOperation[] { operation1, operation2 } ); testQueueOperation.Start(); Assert.IsFalse(testQueueOperation.Ended); operation1.SetEnded(); Assert.IsFalse(testQueueOperation.Ended); operation2.SetEnded(new AbortedException("Hello World")); Assert.Throws <AbortedException>( delegate() { testQueueOperation.Join(); } ); }