コード例 #1
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void CompareTwoBooleans()
        {
            TestNotEqual <bool, bool, bool> notEqual = new TestNotEqual <bool, bool, bool>(true, false);

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
コード例 #2
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void TryNotEqualsOnIncompatibleTypes()
        {
            TestNotEqual <int, string, int> notEq = new TestNotEqual <int, string, int> {
                Right = "3"
            };

            TestRuntime.ValidateInstantiationException(notEq, TestExpressionTracer.GetExceptionMessage <int, string, int>(System.Linq.Expressions.ExpressionType.NotEqual));
        }
コード例 #3
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void ConstraintViolatonInvalidExpression()
        {
            TestNotEqual <int, string, string> notEq = new TestNotEqual <int, string, string>();

            string errorMessage = TestExpressionTracer.GetExceptionMessage <int, string, string>(System.Linq.Expressions.ExpressionType.NotEqual);

            TestExpressionTracer.Validate(notEq, new List <string> {
                errorMessage
            });
        }
コード例 #4
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void SetRightOperandNull()
        {
            TestNotEqual <int, int, bool> notEq = new TestNotEqual <int, int, bool>
            {
                Left = 12
            };

            string errorMessage = string.Format(ErrorStrings.RequiredArgumentValueNotSupplied, "Right");

            TestRuntime.ValidateWorkflowErrors(notEq, new List <TestConstraintViolation>(), typeof(ArgumentException), errorMessage);
        }
コード例 #5
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void CustomTypeOperandWithOperatorOverloaded()
        {
            TestNotEqual <Complex, Complex, bool> notEq = new TestNotEqual <Complex, Complex, bool>
            {
                LeftExpression  = context => new Complex(1, 1),
                RightExpression = context => new Complex(2, 1),
            };

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

            TestRuntime.RunAndValidateWorkflow(seq);
        }
コード例 #6
0
ファイル: NotEqual.cs プロジェクト: sunxiaotianmg/CoreWF
        public void ThrowFromOverloadedOperator()
        {
            TestNotEqual <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool> notEq = new TestNotEqual <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool>
            {
                LeftExpression  = context => new OverLoadOperatorThrowingType(13),
                RightExpression = context => new OverLoadOperatorThrowingType(14),
            };

            OverLoadOperatorThrowingType.ThrowException = true;

            notEq.ExpectedOutcome = Outcome.UncaughtException();

            TestSequence seq = TestExpressionTracer.GetTraceableBinaryExpressionActivity <OverLoadOperatorThrowingType, OverLoadOperatorThrowingType, bool>(notEq, "12");

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