public void MultiplyTwoPositiveIntegers() { TestMultiply <int, int, int> multiply = new TestMultiply <int, int, int>(3, 4); TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(multiply, "12"); TestRuntime.RunAndValidateWorkflow(seq); }
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)); }
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 }); }
public void LeftOperandNull() { TestMultiply <int, int, int> multiply = new TestMultiply <int, int, int> { Right = 12 }; string errorMessage = string.Format(ErrorStrings.RequiredArgumentValueNotSupplied, "Left"); TestRuntime.ValidateWorkflowErrors(multiply, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage); }
public void CustomTypeOverloadedMultiplyOperatorAsOperands() { TestMultiply <Complex, Complex, Complex> mulComplex = new TestMultiply <Complex, Complex, Complex> { LeftExpression = context => new Complex(1, 2), RightExpression = context => new Complex(2, 3), }; TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, Complex>(mulComplex, "2 6"); TestRuntime.RunAndValidateWorkflow(seq); }
public void CheckedMultiplyOverflow() { // // Test case description: // multiply two integers which result in overflow of integer. OverflowException is expected. TestMultiply <int, int, int> multiply = new TestMultiply <int, int, int>() { Checked = true, Right = 2, Left = int.MaxValue, HintExceptionThrown = typeof(OverflowException) }; TestRuntime.RunAndValidateAbortedException(multiply, typeof(OverflowException), null); }