Exemplo n.º 1
0
        public void CompareTwoIntegers()
        {
            TestLessThanOrEqual <int, int, bool> lessThanOrEqual = new TestLessThanOrEqual <int, int, bool>(2, 2);

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 2
0
        public void SetRightOperandNull()
        {
            TestLessThanOrEqual <int, int, bool> lessThanOrEqual = new TestLessThanOrEqual <int, int, bool> {
                Left = 10
            };

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

            TestRuntime.ValidateWorkflowErrors(lessThanOrEqual, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage);
        }
Exemplo n.º 3
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestLessThanOrEqual <Complex, Complex, bool> lessThanOrEqual = new TestLessThanOrEqual <Complex, Complex, bool>
            {
                LeftExpression  = context => new Complex(2, 3),
                RightExpression = context => new Complex(2, 4),
            };

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 4
0
        public void TryLessThanOrEqualOnIncompatibleTypes()
        {
            TestLessThanOrEqual <int, string, bool> lessThanOrEqual = new TestLessThanOrEqual <int, string, bool> {
                Left = 1, Right = "1"
            };

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

            TestRuntime.ValidateWorkflowErrors(lessThanOrEqual, new List <TestConstraintViolation>()
            {
                new TestConstraintViolation(error, lessThanOrEqual.ProductActivity)
            }, error);
        }
Exemplo n.º 5
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestLessThanOrEqual <PublicType, string, bool> lessThanOrEqual = new TestLessThanOrEqual <PublicType, string, bool>
            {
                LeftExpression = context => new PublicType(),
                Right          = "1"
            };

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

            TestExpressionTracer.Validate(lessThanOrEqual, new List <string> {
                error
            });
        }
Exemplo n.º 6
0
        public void ThrowFromOverloadedOperator()
        {
            TestLessThanOrEqual <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool> lessThanOrEqual = new TestLessThanOrEqual <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>(lessThanOrEqual, true.ToString());

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