Esempio n. 1
0
        public void Should_apply_dynamic_object_result_processing_executor()
        {
            var customResult1 = new[] { new DynamicObject("result1") };
            var customResult2 = new[] { new DynamicObject("result2") };

            var callCounter = new int[3];

            var executor = new TestExpressionExecutor();

            executor
            .With((IEnumerable <DynamicObject> x) =>
            {
                callCounter[0]++;
                x.ShouldBeSameAs(TestExpressionExecutor.Step7_Result);
                return(customResult1);
            })
            .With((IEnumerable <DynamicObject> x) =>
            {
                callCounter[1]++;
                x.ShouldBeSameAs(customResult1);
                return(customResult2);
            })
            .With((IEnumerable <DynamicObject> x) =>
            {
                callCounter[2]++;
                x.ShouldBeSameAs(customResult2);
                return(TestExpressionExecutor.Step7_Result);
            })
            .Execute(TestExpressionExecutor.Step0_Expression)
            .ShouldBeSameAs(TestExpressionExecutor.Step7_Result);

            executor.AssertAllMethodsInvokedExacltyOnce();
            callCounter.ShouldAllBe(x => x == 1);
        }
Esempio n. 2
0
        public void Should_apply_remote_expression_preparation_executor()
        {
            var customExpression1 = new ConstantExpression("exp1");
            var customExpression2 = new ConstantExpression("exp2");

            var callCounter = new int[3];

            var executor = new TestExpressionExecutor();

            executor
            .With(x =>
            {
                callCounter[0]++;
                x.ShouldBeSameAs(TestExpressionExecutor.Step1_Expression);
                return(customExpression1);
            })
            .With(x =>
            {
                callCounter[1]++;
                x.ShouldBeSameAs(customExpression1);
                return(customExpression2);
            })
            .With(x =>
            {
                callCounter[2]++;
                x.ShouldBeSameAs(customExpression2);
                return(TestExpressionExecutor.Step1_Expression);
            })
            .Execute(TestExpressionExecutor.Step0_Expression)
            .ShouldBeSameAs(TestExpressionExecutor.Step7_Result);

            executor.AssertAllMethodsInvokedExacltyOnce();
            callCounter.ShouldAllBe(x => x == 1);
        }
Esempio n. 3
0
        public void Should_apply_raw_result_processing_executor()
        {
            var customResult1 = "result1";
            var customResult2 = "result2";

            var callCounter = new int[3];

            var executor = new TestExpressionExecutor();

            executor
            .With((object x) =>
            {
                callCounter[0]++;
                x.ShouldBeSameAs(TestExpressionExecutor.Step5_Result);
                return(customResult1);
            })
            .With((object x) =>
            {
                callCounter[1]++;
                x.ShouldBeSameAs(customResult1);
                return(customResult2);
            })
            .With((object x) =>
            {
                callCounter[2]++;
                x.ShouldBeSameAs(customResult2);
                return(TestExpressionExecutor.Step5_Result);
            })
            .Execute(TestExpressionExecutor.Step0_Expression)
            .ShouldBeSameAs(TestExpressionExecutor.Step7_Result);

            executor.AssertAllMethodsInvokedExacltyOnce();
            callCounter.ShouldAllBe(x => x == 1);
        }