public void TestExceptionHandling() { var job1 = new TestJob("Job1") { ThrowException = true }; var graph = new GraphMap <string, JobBase <string>, IGraphEdge <string> > { job1, }; var jobHost = new OrchestratorBuilder <string, JobBase <string>, IGraphEdge <string> >(graph) .Build() .Start(_workContext); jobHost.Wait(_workContext); jobHost.RunningTask.IsCompleted.Should().BeTrue(); jobHost.GetProcessedNodeKeys().Count.Should().Be(0); jobHost.GetStopNodeKeys().Count.Should().Be(1); graph.Nodes.Values .All(x => x.GetResult(_workContext).Status == JobStatus.Failed) .Should() .BeTrue(); }
public void TestException2Handling() { var job1 = new TestJob("Job1") { ThrowException = true }; var job1a = new TestJob("Job1-a"); var job2 = new TestJob("Job2-a", job1); var graph = new GraphMap <string, JobBase <string>, IGraphEdge <string> > { job1, job1a, job2, new GraphEdge <string>(job1.Key, job2.Key) }; var jobHost = new OrchestratorBuilder <string, JobBase <string>, IGraphEdge <string> >(graph) .Build() .Start(_workContext); jobHost.Wait(_workContext); jobHost.RunningTask.IsCompleted.Should().BeTrue(); jobHost.GetProcessedNodeKeys().ForEach(x => _output.WriteLine($"ProcessNode: {x}")); jobHost.GetProcessedNodeKeys().Count.Should().Be(1); jobHost.GetStopNodeKeys().Count.Should().Be(1); jobHost.GetProcessedNodeKeys().Last().Should().Be(job1a.Key); }
public void ThreeMix1JobTest() { var job1 = new TestJob("Job1"); var job1a = new TestJob("Job1-a"); var job2 = new TestJob("Job2-a", job1); var graph = new GraphMap <string, JobBase <string>, IGraphEdge <string> > { job1, job1a, job2, new GraphEdge <string>(job1.Key, job2.Key) }; var jobHost = new OrchestratorBuilder <string, JobBase <string>, IGraphEdge <string> >(graph) .Build() .Start(_workContext); jobHost.Wait(_workContext); jobHost.RunningTask.IsCompleted.Should().BeTrue(); jobHost.GetProcessedNodeKeys().ForEach(x => _output.WriteLine($"ProcessNode: {x}")); jobHost.GetProcessedNodeKeys().Count.Should().Be(3); jobHost.GetProcessedNodeKeys().Last().Should().Be(job2.Key); graph.Nodes.Values .All(x => x.GetResult(_workContext).Status == JobStatus.Completed) .Should() .BeTrue(); }