public void SetLeftOperandNull() { Variable <bool> var = new Variable <bool> { Default = true }; TestOrElse orElse = new TestOrElse { Right = var }; TestSequence seq = new TestSequence { Variables = { var }, Activities = { orElse } }; List <TestConstraintViolation> constraints = new List <TestConstraintViolation>(); constraints.Add(new TestConstraintViolation( string.Format(ErrorStrings.BinaryExpressionActivityRequiresArgument, "Left", "OrElse", orElse.DisplayName), orElse.ProductActivity)); TestRuntime.ValidateWorkflowErrors( seq, constraints, string.Format(ErrorStrings.BinaryExpressionActivityRequiresArgument, "Left", "OrElse", orElse.DisplayName)); }
public void TwoBooleansInOrElse() { TestOrElse orElse = new TestOrElse(false, true); TestSequence seq = TestExpressionTracer.GetTraceableBoolResultActivity(orElse, true.ToString()); TestRuntime.RunAndValidateWorkflow(seq); }
/// <summary> /// Throw exception in left activity. /// </summary> /// This test is disabled in desktop and failing too. //[Fact] public void ThrowExceptionWhileEvaluatingLeft() { TestOrElse orElse = new TestOrElse { LeftActivity = new TestExpressionEvaluatorWithBody <bool> { Body = new TestThrow <ArithmeticException>() }, RightActivity = new TestExpressionEvaluatorWithBody <bool> { Body = new TestThrow <ArithmeticException>() }, ExceptionInLeft = true }; TestRuntime.RunAndValidateAbortedException(orElse, typeof(ArithmeticException), null); }
/// <summary> /// Throw exception while evaluating right activity. /// </summary> /// This test is disabled in desktop and failing too. //[Fact] private void ThrowExceptionInRightActivity() { TestOrElse orElse = new TestOrElse { LeftActivity = new TestExpressionEvaluator <bool> { ExpressionResult = false }, RightActivity = new TestExpressionEvaluatorWithBody <bool> { Body = new TestThrow <ArithmeticException>() }, ExceptionInRight = true }; TestRuntime.RunAndValidateAbortedException(orElse, typeof(ArithmeticException), null); }
public void ShortCircuitEvaluation() { TestOrElse orElse = new TestOrElse { LeftActivity = new TestExpressionEvaluator <bool> { ExpressionResult = true }, RightActivity = new TestExpressionEvaluatorWithBody <bool> { Body = new TestThrow <Exception>() }, HintShortCircuit = true }; TestSequence seq = TestExpressionTracer.GetTraceableBoolResultActivity(orElse, true.ToString()); TestRuntime.RunAndValidateWorkflow(seq); }