Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public void CompareTwoIntegers()
        {
            TestGreaterThan <int, int, bool> greaterThan = new TestGreaterThan <int, int, bool>(2, 3);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, bool>(greaterThan, false.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 4
0
        public void AddTwoPositiveIntegers()
        {
            TestAdd <int, int, int> add = new TestAdd <int, int, int>(3, 4);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(add, "7");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 5
0
        public void CompareTwoBooleans()
        {
            TestEqual <bool, bool, bool> equal = new TestEqual <bool, bool, bool>(true, false);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <bool, bool, bool>(equal, false.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 6
0
        public void TwoBooleansInOr()
        {
            TestOr <bool, bool, bool> or = new TestOr <bool, bool, bool>(false, true);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <bool, bool, bool>(or, true.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        public void SubtractTwoPositiveIntegers()
        {
            TestSubtract <int, int, int> sub = new TestSubtract <int, int, int>(4, 4);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(sub, "0");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 9
0
        public void DivideTwoPositiveIntegers()
        {
            TestDivide <int, int, int> divide = new TestDivide <int, int, int>(12, 4);

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <int, int, int>(divide, "3");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 10
0
        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);
        }
Exemplo n.º 11
0
        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);
        }
Exemplo n.º 12
0
        public void CustomTypeOverloadedSubOperatorAsOperands()
        {
            TestSubtract <Complex, Complex, Complex> subComplex = new TestSubtract <Complex, Complex, Complex>
            {
                LeftExpression  = context => new Complex(1, 2),
                RightExpression = context => new Complex(2, 3),
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, Complex>(subComplex, "-1 -1");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 13
0
        public void SubtractTwoCompatibleDifferentTypes()
        {
            TestSubtract <DateTime, TimeSpan, DateTime> sub = new TestSubtract <DateTime, TimeSpan, DateTime>
            {
                Left  = new DateTime(2009, 2, 12),
                Right = new TimeSpan(17, 58, 59)
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity(sub, new DateTime(2009, 2, 11, 06, 01, 01).ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 14
0
        public void AddTwoCompatibleDifferentTypes()
        {
            TestAdd <DateTime, TimeSpan, DateTime> add = new TestAdd <DateTime, TimeSpan, DateTime>
            {
                Left  = new DateTime(2009, 2, 12),
                Right = new TimeSpan(17, 58, 59)
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <DateTime, TimeSpan, DateTime>(add, @"2/12/2009 5:58:59 PM");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 15
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestOr <Complex, Complex, Complex> complexOr = new TestOr <Complex, Complex, Complex>()
            {
                LeftExpression  = context => new Complex(1, 2),
                RightExpression = context => new Complex(2, 3)
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, Complex>(complexOr, new Complex(1 | 2, 2 | 3).ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 16
0
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestGreaterThan <Complex, Complex, bool> greaterThan = new TestGreaterThan <Complex, Complex, bool>
            {
                LeftExpression  = context => new Complex(2, 3),
                RightExpression = context => new Complex(1, 4),
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, bool>(greaterThan, true.ToString());

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 17
0
        public void CustomTypeOverloadedDivideOperatorAsOperands()
        {
            TestDivide <Complex, Complex, Complex> divide = new TestDivide <Complex, Complex, Complex>
            {
                LeftExpression  = context => new Complex(2, 6),
                RightExpression = context => new Complex(1, 2),
            };

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <Complex, Complex, Complex>(divide, "2 3");

            TestRuntime.RunAndValidateWorkflow(seq);
        }
Exemplo n.º 18
0
        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);
        }
Exemplo n.º 19
0
        public void ThrowFromOverloadedOperator()
        {
            TestGreaterThan <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool> greaterThan = new TestGreaterThan <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>(greaterThan, true.ToString());

            TestRuntime.RunAndValidateAbortedException(seq, typeof(ArithmeticException), null);
        }
Exemplo n.º 20
0
        public void ThrowFromOverloadedOperator()
        {
            TestOr <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, int> or = new TestOr <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, int>
            {
                LeftExpression  = context => new OverLoadOperatorThrowingType(13),
                RightExpression = context => new OverLoadOperatorThrowingType(14),
            };

            OverLoadOperatorThrowingType.ThrowException = true;

            or.ExpectedOutcome = Outcome.UncaughtException();

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, int>(or, "12");

            TestRuntime.RunAndValidateAbortedException(seq, typeof(ArithmeticException), null);
        }