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 }); }
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); }
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); }