Example #1
0
        public void TryNotEqualsOnIncompatibleTypes()
        {
            TestNotEqual <int, string, int> notEq = new TestNotEqual <int, string, int> {
                Right = "3"
            };

            TestRuntime.ValidateInstantiationException(notEq, TestExpressionTracer.GetExceptionMessage <int, string, int>(System.Linq.Expressions.ExpressionType.NotEqual));
        }
Example #2
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));
        }
Example #3
0
        public void AddTwoIncompatibleTypes()
        {
            TestAdd <int, string, string> add = new TestAdd <int, string, string>
            {
                Left  = 12,
                Right = "12"
            };

            TestRuntime.ValidateInstantiationException(add, TestExpressionTracer.GetExceptionMessage <int, string, string>(exp.ExpressionType.Add));
        }
Example #4
0
        public void MultiplyTwoIncompatibleTypes()
        {
            TestMultiply <int, string, string> multiply = new TestMultiply <int, string, string>
            {
                Left  = 12,
                Right = "12"
            };

            TestRuntime.ValidateInstantiationException(multiply, TestExpressionTracer.GetExceptionMessage <int, string, string>(exp.ExpressionType.Multiply));
        }
Example #5
0
        public void ConstraintViolationIncompatibleTypes()
        {
            TestMultiply <int, string, string> mul = new TestMultiply <int, string, string>();

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

            TestExpressionTracer.Validate(mul, new List <string> {
                errorMessage
            });
        }
Example #6
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestNot <string, Complex> not = new TestNot <string, Complex>();

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

            TestExpressionTracer.Validate(not, new List <string> {
                errorMessage
            });
        }
Example #7
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
            });
        }
Example #8
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestNotEqual <int, string, string> notEq = new TestNotEqual <int, string, string>();

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

            TestExpressionTracer.Validate(notEq, new List <string> {
                errorMessage
            });
        }
Example #9
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
            });
        }
Example #10
0
        public void TryEqualsOnIncompatibleTypes()
        {
            TestEqual <int, string, string> eq = new TestEqual <int, string, string>
            {
                Left  = 12,
                Right = "12"
            };

            TestRuntime.ValidateInstantiationException(eq, TestExpressionTracer.GetExceptionMessage <int, string, string>(System.Linq.Expressions.ExpressionType.Equal));
        }
Example #11
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));
        }
Example #12
0
        public void SubtractTwoIncompatibleTypes()
        {
            TestSubtract <int, string, string> sub = new TestSubtract <int, string, string>
            {
                Left  = 12,
                Right = "12"
            };

            TestRuntime.ValidateInstantiationException(sub, TestExpressionTracer.GetExceptionMessage <int, string, string>(exp.ExpressionType.Subtract));
        }
Example #13
0
        public void ConstraintViolatonInvalidExpression()
        {
            TestCast <string, int> cast = new TestCast <string, int> {
                Operand = "Hello"
            };

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

            TestExpressionTracer.Validate(cast, new List <string> {
                errorMessage
            });
        }
Example #14
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);
        }
Example #15
0
        public void TryCastingUnrelatedTypes()
        {
            TestCast <string, int> cast = new TestCast <string, int> {
                Operand = "Hello"
            };

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

            TestRuntime.ValidateWorkflowErrors(cast, new List <TestConstraintViolation>()
            {
                new TestConstraintViolation(errorMessage, cast.ProductActivity, false)
            }, errorMessage);
        }
Example #16
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);
        }
Example #17
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
            });
        }
Example #18
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
            });
        }
Example #19
0
        public void SubtractTwoIncompatibleTypes()
        {
            TestDivide <int, double, double> divide = new TestDivide <int, double, double>(4, 4.2);

            TestRuntime.ValidateInstantiationException(divide, TestExpressionTracer.GetExceptionMessage <int, double, double>(System.Linq.Expressions.ExpressionType.Divide));
        }