Beispiel #1
0
        public void CompareTwoIntegers()
        {
            TestGreaterThan <int, int, bool> greaterThan = new TestGreaterThan <int, int, bool>(2, 3);

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Beispiel #2
0
        public void SetRightOperandNull()
        {
            TestGreaterThan <int, int, bool> greaterThan = new TestGreaterThan <int, int, bool> {
                Left = 10
            };

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

            TestRuntime.ValidateWorkflowErrors(greaterThan, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage);
        }
Beispiel #3
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestGreaterThan <Complex, Complex, bool> greaterThan = new TestGreaterThan <Complex, Complex, bool>
            {
                LeftExpression  = context => new Complex(2, 3),
                RightExpression = context => new Complex(1, 4),
            };

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Beispiel #4
0
        public void TryGreaterThanOnIncompatibleTypes()
        {
            TestGreaterThan <int, string, bool> greaterThan = new TestGreaterThan <int, string, bool> {
                Left = 1, Right = "1"
            };

            string error = TestExpressionTracer.GetExceptionMessage <int, string, bool>(System.Linq.Expressions.ExpressionType.GreaterThan);

            TestRuntime.ValidateWorkflowErrors(greaterThan, new List <TestConstraintViolation>()
            {
                new TestConstraintViolation(error, greaterThan.ProductActivity)
            }, error);
        }
Beispiel #5
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestGreaterThan <PublicType, string, bool> greaterThan = new TestGreaterThan <PublicType, string, bool>
            {
                LeftExpression = context => new PublicType(),
                Right          = "1"
            };

            string error = TestExpressionTracer.GetExceptionMessage <PublicType, string, bool>(System.Linq.Expressions.ExpressionType.GreaterThan);

            TestExpressionTracer.Validate(greaterThan, new List <string> {
                error
            });
        }
Beispiel #6
0
        public void ThrowFromOverloadedOperator()
        {
            TestGreaterThan <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool> greaterThan = new TestGreaterThan <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool>
            {
                LeftExpression  = context => new OverLoadOperatorThrowingType(2),
                RightExpression = context => new OverLoadOperatorThrowingType(1),
                ExpectedOutcome = Outcome.UncaughtException()
            };

            OverLoadOperatorThrowingType.ThrowException = true;

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

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