public void Faulted_Node_Throws_If_Throw_On_Error_True() { var testNode = new FaultingTestNodeA(); var testObjectList = GetTestObjects(); Assert.ThrowsAsync <AggregateException>(() => testNode.ExecuteManyAsync(testObjectList, new ExecutionOptions { ThrowOnError = true, DegreeOfParallelism = 4 })); }
public async Task Faulted_Node_Run_Status_Is_Failed_If_Continue_On_Failure_True() { var testNode = new FaultingTestNodeA(); var testObjectList = GetTestObjects(); var result = await testNode.ExecuteManyAsync(testObjectList, new ExecutionOptions { ContinueOnFailure = true, DegreeOfParallelism = 4 }); result.Status.Should().Be(NodeResultStatus.Failed); result.Exception.Should().NotBeNull(); testNode.Status.Should().Be(NodeRunStatus.Faulted); }
public void Errant_Node_Run_With_ThrowOnError_True_Throws() { var testNode = new FaultingTestNodeA(); var testObject = new TestObjectA(); var context = new ExecutionContext <TestObjectA>(testObject) { GlobalOptions = { ThrowOnError = true } }; Assert.Throws <Exception>(async() => await testNode.ExecuteAsync(context)); }
public async void Errant_Node_Run_Status_Is_Faulted() { var testNode = new FaultingTestNodeA(); var testObject = new TestObjectA(); var context = new ExecutionContext <TestObjectA>(testObject); var result = await testNode.ExecuteAsync(context); result.Exception.ShouldNotBeNull(); testNode.Status.ShouldEqual(NodeRunStatus.Faulted); }
public void Faulted_Node_Throws_If_Throw_On_Error_True() { var testNode = new FaultingTestNodeA(); var testObject1 = new TestObjectA(); var testObject2 = new TestObjectA(); var testObjectList = new List <TestObjectA> { testObject1, testObject2 }; Assert.ThrowsAsync <AggregateException>(() => testNode.ExecuteManyAsync(testObjectList, new ExecutionOptions { ThrowOnError = true })); }
public void Faulted_Sync_Node_Throws_If_Throw_On_Error_True() { var testNode = new FaultingTestNodeA(); var testObject1 = new TestObjectA(); var testObject2 = new TestObjectA(); var testObjectList = new List <TestObjectA> { testObject1, testObject2 }; Assert.Throws <Exception>(async() => await testNode.ExecuteManySeriallyAsync(testObjectList, new ExecutionOptions { ThrowOnError = true })); }
public async Task Faulted_Node_Run_Status_Is_Failed_If_Continue_On_Failure_True() { var testNode = new FaultingTestNodeA(); var testObject1 = new TestObjectA(); var testObject2 = new TestObjectA(); var testObjectList = new List <TestObjectA> { testObject1, testObject2 }; var result = await testNode.ExecuteManyAsync(testObjectList, new ExecutionOptions { ContinueOnFailure = true }); result.Status.Should().Be(NodeResultStatus.Failed); result.Exception.Should().NotBeNull(); testNode.Status.Should().Be(NodeRunStatus.Faulted); }
public async Task Group_Run_With_Multiple_Failures_Returns_Failed_Statuses() { var pipelineNode = new GroupNode <TestObjectA>(); var faultNode1 = new FaultingTestNodeA(); var faultNode2 = new FaultingTestNodeA(); pipelineNode.AddChild(faultNode1); pipelineNode.AddChild(faultNode2); var testObject = new TestObjectA(); NodeResult result = await pipelineNode.ExecuteAsync(testObject); IEnumerable <Exception> exceptions = result.GetFailExceptions(); exceptions.Should().NotBeNull(); exceptions.Count().Should().BeGreaterThan(0); }
public async Task FirstMatch_Node_Fails_When_Selected_Node_Faults() { var matchNode = new FirstMatchNode <TestObjectA>(); var firstNode = new FaultingTestNodeA(); matchNode.AddChild(firstNode); var secondNode = new SimpleTestNodeA2(); matchNode.AddChild(secondNode); var testObject = new TestObjectA(); NodeResult result = await matchNode.ExecuteAsync(testObject); matchNode.Status.Should().Be(NodeRunStatus.Completed); firstNode.Status.Should().Be(NodeRunStatus.Faulted); secondNode.Status.Should().Be(NodeRunStatus.NotRun); result.Status.Should().Be(NodeResultStatus.Failed); testObject.TestValueString.Should().Be("Faulted"); testObject.TestValueInt.Should().Be(0); }