Exemplo n.º 1
0
        public void ComputeIntegralAnd()
        {
            TestAnd <int, int, int> and = new TestAnd <int, int, int>(2, 2); //010 & 010 = 010

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(and, "2");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 2
0
        public void TwoBooleansInAnd()
        {
            TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool>(true, false);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <bool, bool, bool>(and, false.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 3
0
        public void ConstraintViolationIncompatibleTypes()
        {
            TestAnd <int, string, string> and = new TestAnd <int, string, string>();

            string errorMessage = TestExpressionTracer.GetExceptionMessage <int, string, string>(System.Linq.Expressions.ExpressionType.And);

            TestExpressionTracer.Validate(and, new List <string> {
                errorMessage
            });
        }
Exemplo n.º 4
0
        public void TryANDOnIncompatibleTypes()
        {
            TestAnd <bool, string, bool> and = new TestAnd <bool, string, bool>
            {
                Left  = true,
                Right = "true"
            };

            TestRuntime.ValidateInstantiationException(and, TestExpressionTracer.GetExceptionMessage <bool, string, bool>(exp.ExpressionType.And));
        }
Exemplo n.º 5
0
        public void SetLeftOperandNull()
        {
            TestAnd <int, int, int> and = new TestAnd <int, int, int>
            {
                Right = 12
            };

            string errorMessage = string.Format(ErrorStrings.RequiredArgumentValueNotSupplied, "Left");

            TestRuntime.ValidateWorkflowErrors(and, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage);
        }
Exemplo n.º 6
0
        //This is disabled in desktop and failing too.
        //[Fact]
        public void ThrowWhileEvaluatingLeft()
        {
            TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool>
            {
                LeftActivity = new TestExpressionEvaluatorWithBody <bool>
                {
                    Body = new TestThrow <ArithmeticException>()
                },
                Right = true
            };

            TestRuntime.RunAndValidateAbortedException(and, typeof(ArithmeticException), null);
        }
Exemplo n.º 7
0
        public void InvokeWithWorkflowInvoker()
        {
            TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool>();

            TestRuntime.RunAndValidateUsingWorkflowInvoker(and,
                                                           new Dictionary <string, object> {
                { "Left", true }, { "Right", false }
            },
                                                           new Dictionary <string, object> {
                { "Result", false }
            },
                                                           new List <object>());
        }
Exemplo n.º 8
0
        public void ThrowFromOverloadedOperator()
        {
            TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType> testAnd = new TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>();

            testAnd.ProductAnd.Left  = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(13));
            testAnd.ProductAnd.Right = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(14));
            OverLoadOperatorThrowingType.ThrowException = true;

            testAnd.ExpectedOutcome = Outcome.UncaughtException();

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(testAnd, "12");

            TestRuntime.RunAndValidateAbortedException(seq, typeof(DivideByZeroException), null);
        }
Exemplo n.º 9
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType> testAnd = new TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>();

            testAnd.ProductAnd.Left  = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(13));
            testAnd.ProductAnd.Right = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(14));
            OverLoadOperatorThrowingType.ThrowException = false;

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(testAnd, "12"); //1101 & 1110 = 1100

            TestRuntime.RunAndValidateWorkflow(seq);
        }