Esempio n. 1
0
        public void TryOROnIncompatibleTypes()
        {
            TestOr <int, string, int> intOr = new TestOr <int, string, int> {
                Right = "3"
            };

            TestRuntime.ValidateInstantiationException(intOr, TestExpressionTracer.GetExceptionMessage <int, string, int>(System.Linq.Expressions.ExpressionType.Or));
        }
Esempio n. 2
0
        public void TwoBooleansInOr()
        {
            TestOr <bool, bool, bool> or = new TestOr <bool, bool, bool>(false, true);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <bool, bool, bool>(or, true.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Esempio n. 3
0
        public void SetLeftOperandNull()
        {
            TestOr <int, int, int> intOr = new TestOr <int, int, int> {
                Right = 3
            };

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

            TestRuntime.ValidateWorkflowErrors(intOr, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage);
        }
Esempio n. 4
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestOr <int, string, string> or = new TestOr <int, string, string>();

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

            TestExpressionTracer.Validate(or, new List <string> {
                errorMessage
            });
        }
Esempio n. 5
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestOr <Complex, Complex, Complex> complexOr = new TestOr <Complex, Complex, Complex>()
            {
                LeftExpression  = context => new Complex(1, 2),
                RightExpression = context => new Complex(2, 3)
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, Complex>(complexOr, new Complex(1 | 2, 2 | 3).ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Esempio n. 6
0
        public void ThrowFromOverloadedOperator()
        {
            TestOr <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, int> or = new TestOr <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, int>
            {
                LeftExpression  = context => new OverLoadOperatorThrowingType(13),
                RightExpression = context => new OverLoadOperatorThrowingType(14),
            };

            OverLoadOperatorThrowingType.ThrowException = true;

            or.ExpectedOutcome = Outcome.UncaughtException();

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

            TestRuntime.RunAndValidateAbortedException(seq, typeof(ArithmeticException), null);
        }