Ejemplo n.º 1
0
        public async void Subject_Of_Inherited_Type_Is_Passed_To_Execute()
        {
            var testNode = new SimpleTestNodeA1();

            var testObject = new TestObjectASub();

            var result = await testNode.ExecuteAsync(testObject);

            testNode.Status.ShouldEqual(NodeRunStatus.Completed);
            result.Status.ShouldEqual(NodeResultStatus.Succeeded);
        }
Ejemplo n.º 2
0
        public async void ExecutionContext_Based_On_Root_Type_Works_With_Inherited_Type()
        {
            var testNode = new SimpleTestNodeA1();

            var testObject = new TestObjectASub();

            var context = new ExecutionContext <TestObjectA>(testObject);

            var result = await testNode.ExecuteAsync(context);

            testNode.Status.ShouldEqual(NodeRunStatus.Completed);
            result.Status.ShouldEqual(NodeResultStatus.Succeeded);
        }
        public async Task ExecutionContext_Based_On_Inherited_Type_Is_Passed_To_Execute()
        {
            var testNode = new SimpleTestNodeA1();

            var testObject = new TestObjectASub();

            var context = new ExecutionContext <TestObjectASub>(testObject);

            var result = await testNode.ExecuteAsync(context);

            testNode.Status.Should().Be(NodeRunStatus.Completed);
            result.Status.Should().Be(NodeResultStatus.Succeeded);
        }
Ejemplo n.º 4
0
        public async void Subject_Of_Inherited_Type_Works_With_Func_Node()
        {
            var node = new FuncNode <TestObjectA>();

            node.ShouldExecuteFunc = context => Task.FromResult(((TestObjectA)context.Subject).TestValueInt == 0);
            node.ExecutedFunc      = context => { context.Subject.TestValueString = "Completed"; return(Task.FromResult(NodeResultStatus.Succeeded)); };

            var        testObject = new TestObjectASub();
            NodeResult result     = await node.ExecuteAsync(testObject);

            node.Status.ShouldEqual(NodeRunStatus.Completed);
            result.Status.ShouldEqual(NodeResultStatus.Succeeded);
            result.GetSubjectAs <TestObjectA>().TestValueString.ShouldEqual("Completed");
        }
Ejemplo n.º 5
0
        public async Task Can_Run_Func_Node_On_Inherited_Type()
        {
            var node = new FuncNode <TestObjectA>();

            node.AddShouldExecute(context => Task.FromResult(context.Subject.TestValueInt == 0));
            node.ExecutedFunc = context => { context.Subject.TestValueString = "Completed"; return(Task.FromResult(NodeResultStatus.Succeeded)); };

            var        testObject = new TestObjectASub();
            NodeResult result     = await node.ExecuteAsync(testObject);

            node.Status.Should().Be(NodeRunStatus.Completed);
            result.Status.Should().Be(NodeResultStatus.Succeeded);
            result.GetSubjectAs <TestObjectA>().TestValueString.Should().Be("Completed");
        }
Ejemplo n.º 6
0
        public async Task Can_Add_Base_Type_Nodes_To_Inherited_Type_Pipeline()
        {
            var testNode  = new SimpleTestNodeA1();
            var testNode2 = new SimpleTestNodeASub1();

            var pipeline = new PipelineNode <TestObjectASub>();

            pipeline.AddChild(testNode);
            pipeline.AddChild(testNode2);

            var testObject = new TestObjectASub();

            var result = await pipeline.ExecuteAsync(testObject);

            testNode.Status.Should().Be(NodeRunStatus.Completed);
            result.Status.Should().Be(NodeResultStatus.Succeeded);
        }
Ejemplo n.º 7
0
        public async Task Can_Add_Inherited_Func_Node_To_Pipleline()
        {
            var testNode = new FuncNode <TestObjectA>();

            testNode.AddShouldExecute(context => Task.FromResult(context.Subject.TestValueInt == 0));
            testNode.ExecutedFunc = context => { context.Subject.TestValueString = "Completed"; return(Task.FromResult(NodeResultStatus.Succeeded)); };

            var testObject = new TestObjectASub();

            var pipeline = new PipelineNode <TestObjectASub>();

            pipeline.AddChild(testNode);

            var result = await pipeline.ExecuteAsync(testObject);

            testNode.Status.Should().Be(NodeRunStatus.Completed);
            result.Status.Should().Be(NodeResultStatus.Succeeded);
        }
Ejemplo n.º 8
0
        public async Task ShouldExecuteFunc_On_Test_Object_Is_Evaluated()
        {
            var testNode  = new SimpleTestNodeA1();
            var testNode2 = new SimpleTestNodeASub1();

            testNode2.AddShouldExecute(context => Task.FromResult(context.Subject.TestValueDecimal == 1));

            var pipeline = new PipelineNode <TestObjectASub>();

            pipeline.AddChild(testNode);
            pipeline.AddChild(testNode2);

            var testObject = new TestObjectASub();

            var result = await pipeline.ExecuteAsync(testObject);

            testNode.Status.Should().Be(NodeRunStatus.Completed);
            testNode2.Status.Should().Be(NodeRunStatus.NotRun);
        }