コード例 #1
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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);
        }
コード例 #2
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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));
        }
コード例 #3
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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
            });
        }
コード例 #4
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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);
        }
コード例 #5
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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);
        }
コード例 #6
0
ファイル: Multiply.cs プロジェクト: jimitndiaye/corewf
        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);
        }