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