Exemple #1
0
        public async Task Group_Overall_Result_Subject_Equals_Last_Changed_Subject()
        {
            var groupNode = new GroupNode <TestObjectA>();

            var node1 = new SimpleTestNodeA1();
            var node2 = new SubjectChangingNode1();
            var node3 = new SimpleTestNodeA2();
            var node4 = new SubjectChangingNode1();

            groupNode.AddChild(node1);
            groupNode.AddChild(node2);
            groupNode.AddChild(node3);
            groupNode.AddChild(node4);

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            groupNode.Status.Should().Be(NodeRunStatus.Completed);

            var childResults = result.ChildResults.ToList();

            result.Subject.Should().NotBeSameAs(testObject);
            result.Subject.Should().NotBeSameAs(childResults[1].Subject);
            result.Subject.Should().NotBeSameAs(childResults[2].Subject);
            result.Subject.Should().BeSameAs(childResults[3].Subject);
        }
        public async void Successful_Group_Run_Status_Is_Succeeded()
        {
            var groupNode = new GroupNode <TestObjectA>();

            groupNode.AddChild(new SimpleTestNodeA1());
            groupNode.AddChild(new SimpleTestNodeA2());

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            groupNode.Status.ShouldEqual(NodeRunStatus.Completed);
        }
        public async void Failed_Group_Run_Returns_Failed_Status()
        {
            var groupNode = new GroupNode <TestObjectA>();

            groupNode.AddChild(new FailingTestNodeA());
            groupNode.AddChild(new FailingTestNodeA());

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            result.Status.ShouldEqual(NodeResultStatus.Failed);
            groupNode.Status.ShouldEqual(NodeRunStatus.Completed);
        }
        public async Task Group_Run_With_Fault_Returns_Failed_Status()
        {
            var groupNode = new GroupNode <TestObjectA>();

            groupNode.AddChild(new SimpleTestNodeA1());
            groupNode.AddChild(new FaultingTestNodeA());

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            result.Status.Should().Be(NodeResultStatus.Failed);
            groupNode.Status.Should().Be(NodeRunStatus.Completed);
        }
        public async void Successful_Group_Result_Matches_Expectations()
        {
            var groupNode = new GroupNode <TestObjectA>();

            groupNode.AddChild(new SimpleTestNodeA1());
            groupNode.AddChild(new SimpleTestNodeA2());

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            result.Status.ShouldEqual(NodeResultStatus.Succeeded);
            testObject.TestValueString.ShouldEqual("Completed");
            testObject.TestValueInt.ShouldEqual(100);
        }
        public async void Group_Run_With_Fault_And_ContinueOnError_Returns_SucceededWithErrors_Status()
        {
            var groupNode = new GroupNode <TestObjectA> {
                LocalOptions = new ExecutionOptions {
                    ContinueOnFailure = true
                }
            };

            groupNode.AddChild(new SimpleTestNodeA1());
            groupNode.AddChild(new FaultingTestNodeA());

            var        testObject = new TestObjectA();
            NodeResult result     = await groupNode.ExecuteAsync(testObject);

            result.Status.ShouldEqual(NodeResultStatus.SucceededWithErrors);
            groupNode.Status.ShouldEqual(NodeRunStatus.Completed);
        }
Exemple #7
0
        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);
        }