示例#1
0
        public void CompareTwoIntegers()
        {
            TestLessThan <int, int, bool> lessThan = new TestLessThan <int, int, bool>(2, 3);

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
示例#2
0
        public void SetRightOperandNull()
        {
            TestLessThan <int, int, bool> lessThan = new TestLessThan <int, int, bool> {
                Left = 10
            };

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

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

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
示例#4
0
        public void TryLessThanOnIncompatibleTypes()
        {
            TestLessThan <int, string, bool> lessThan = new TestLessThan <int, string, bool> {
                Left = 1, Right = "1"
            };

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

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

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

            TestExpressionTracer.Validate(lessThan, new List <string> {
                error
            });
        }
示例#6
0
        public void ThrowFromOverloadedOperator()
        {
            TestLessThan <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool> lessThan = new TestLessThan <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>(lessThan, true.ToString());

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