Пример #1
0
        public void SetLeftOperandNull()
        {
            Variable <bool> var = new Variable <bool> {
                Default = true
            };
            TestOrElse orElse = new TestOrElse {
                Right = var
            };

            TestSequence seq = new TestSequence
            {
                Variables  = { var },
                Activities = { orElse }
            };

            List <TestConstraintViolation> constraints = new List <TestConstraintViolation>();

            constraints.Add(new TestConstraintViolation(
                                string.Format(ErrorStrings.BinaryExpressionActivityRequiresArgument,
                                              "Left",
                                              "OrElse",
                                              orElse.DisplayName),
                                orElse.ProductActivity));

            TestRuntime.ValidateWorkflowErrors(
                seq,
                constraints,
                string.Format(ErrorStrings.BinaryExpressionActivityRequiresArgument, "Left", "OrElse", orElse.DisplayName));
        }
Пример #2
0
        public void TwoBooleansInOrElse()
        {
            TestOrElse orElse = new TestOrElse(false, true);

            TestSequence seq = TestExpressionTracer.GetTraceableBoolResultActivity(orElse, true.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Пример #3
0
        /// <summary>
        /// Throw exception in left activity.
        /// </summary>
        /// This test is disabled in desktop and failing too.
        //[Fact]
        public void ThrowExceptionWhileEvaluatingLeft()
        {
            TestOrElse orElse = new TestOrElse
            {
                LeftActivity = new TestExpressionEvaluatorWithBody <bool>
                {
                    Body = new TestThrow <ArithmeticException>()
                },
                RightActivity = new TestExpressionEvaluatorWithBody <bool>
                {
                    Body = new TestThrow <ArithmeticException>()
                },
                ExceptionInLeft = true
            };

            TestRuntime.RunAndValidateAbortedException(orElse, typeof(ArithmeticException), null);
        }
Пример #4
0
        /// <summary>
        /// Throw exception while evaluating right activity.
        /// </summary>
        /// This test is disabled in desktop and failing too.
        //[Fact]
        private void ThrowExceptionInRightActivity()
        {
            TestOrElse orElse = new TestOrElse
            {
                LeftActivity = new TestExpressionEvaluator <bool>
                {
                    ExpressionResult = false
                },
                RightActivity = new TestExpressionEvaluatorWithBody <bool>
                {
                    Body = new TestThrow <ArithmeticException>()
                },
                ExceptionInRight = true
            };

            TestRuntime.RunAndValidateAbortedException(orElse, typeof(ArithmeticException), null);
        }
Пример #5
0
        public void ShortCircuitEvaluation()
        {
            TestOrElse orElse = new TestOrElse
            {
                LeftActivity = new TestExpressionEvaluator <bool>
                {
                    ExpressionResult = true
                },
                RightActivity = new TestExpressionEvaluatorWithBody <bool>
                {
                    Body = new TestThrow <Exception>()
                },
                HintShortCircuit = true
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBoolResultActivity(orElse, true.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }