示例#1
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
            });
        }
示例#2
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);
        }
示例#3
0
        public void CheckedCastOverflow()
        {
            //
            //  Test case description:
            //  Cast long to short which result in overflow of integer. OverflowException is expected.

            TestCast <long, short> cast = new TestCast <long, short>()
            {
                Checked             = true,
                Operand             = short.MaxValue + 1L,
                HintExceptionThrown = typeof(OverflowException)
            };

            TestRuntime.RunAndValidateAbortedException(cast, typeof(OverflowException), null);
        }