public void ComputeIntegralAnd() { TestAnd <int, int, int> and = new TestAnd <int, int, int>(2, 2); //010 & 010 = 010 TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(and, "2"); TestRuntime.RunAndValidateWorkflow(seq); }
public void TwoBooleansInAnd() { TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool>(true, false); TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <bool, bool, bool>(and, false.ToString()); TestRuntime.RunAndValidateWorkflow(seq); }
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 }); }
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)); }
public void SetLeftOperandNull() { TestAnd <int, int, int> and = new TestAnd <int, int, int> { Right = 12 }; string errorMessage = string.Format(ErrorStrings.RequiredArgumentValueNotSupplied, "Left"); TestRuntime.ValidateWorkflowErrors(and, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage); }
//This is disabled in desktop and failing too. //[Fact] public void ThrowWhileEvaluatingLeft() { TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool> { LeftActivity = new TestExpressionEvaluatorWithBody <bool> { Body = new TestThrow <ArithmeticException>() }, Right = true }; TestRuntime.RunAndValidateAbortedException(and, typeof(ArithmeticException), null); }
public void InvokeWithWorkflowInvoker() { TestAnd <bool, bool, bool> and = new TestAnd <bool, bool, bool>(); TestRuntime.RunAndValidateUsingWorkflowInvoker(and, new Dictionary <string, object> { { "Left", true }, { "Right", false } }, new Dictionary <string, object> { { "Result", false } }, new List <object>()); }
public void ThrowFromOverloadedOperator() { TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType> testAnd = new TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(); testAnd.ProductAnd.Left = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(13)); testAnd.ProductAnd.Right = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(14)); OverLoadOperatorThrowingType.ThrowException = true; testAnd.ExpectedOutcome = Outcome.UncaughtException(); TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(testAnd, "12"); TestRuntime.RunAndValidateAbortedException(seq, typeof(DivideByZeroException), null); }
public void CustomTypeOperandWithOperatorOverloaded() { TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType> testAnd = new TestAnd <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(); testAnd.ProductAnd.Left = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(13)); testAnd.ProductAnd.Right = new InArgument <OverLoadOperatorThrowingType>(context => new OverLoadOperatorThrowingType(14)); OverLoadOperatorThrowingType.ThrowException = false; TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, OverLoadOperatorThrowingType>(testAnd, "12"); //1101 & 1110 = 1100 TestRuntime.RunAndValidateWorkflow(seq); }