コード例 #1
0
ファイル: And.cs プロジェクト: stephensmitchell-forks/corewf
        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
            });
        }
コード例 #2
0
ファイル: Or.cs プロジェクト: sunxiaotianmg/CoreWF
        public void ConstraintViolatonInvalidExpression()
        {
            TestOr <int, string, string> or = new TestOr <int, string, string>();

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

            TestExpressionTracer.Validate(or, new List <string> {
                errorMessage
            });
        }
コード例 #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
        public void ConstraintViolatonInvalidExpression()
        {
            TestNot <string, Complex> not = new TestNot <string, Complex>();

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

            TestExpressionTracer.Validate(not, new List <string> {
                errorMessage
            });
        }
コード例 #5
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
            });
        }
コード例 #6
0
        public void ConstraintErrorForPropertyNameNull()
        {
            TestPropertyValue <PublicType, int> propertyValue = new TestPropertyValue <PublicType, int>
            {
                OperandExpression = context => new PublicType()
            };

            TestExpressionTracer.Validate(propertyValue, new List <string> {
                string.Format(ErrorStrings.ActivityPropertyMustBeSet, "PropertyName", propertyValue.DisplayName)
            });
        }
コード例 #7
0
        public void ConstraintErrorForFieldNameNull()
        {
            TestFieldReference <PublicType, int> fieldRef = new TestFieldReference <PublicType, int> {
                OperandExpression = context => new PublicType()
            };

            string error = string.Format(ErrorStrings.ActivityPropertyMustBeSet, "FieldName", fieldRef.DisplayName);

            TestExpressionTracer.Validate(fieldRef, new List <string> {
                error
            });
        }
コード例 #8
0
        public void ConstraintErrorForInvalidProperty()
        {
            TestPropertyValue <PublicType, int> propertyValue = new TestPropertyValue <PublicType, int>
            {
                OperandExpression = context => new PublicType(),
                PropertyName      = "Invalid"
            };

            TestExpressionTracer.Validate(propertyValue, new List <string> {
                string.Format(ErrorStrings.MemberNotFound, "Invalid", typeof(PublicType).Name)
            });
        }
コード例 #9
0
ファイル: Cast.cs プロジェクト: stephensmitchell-forks/corewf
        public void ConstraintViolatonInvalidExpression()
        {
            TestCast <string, int> cast = new TestCast <string, int> {
                Operand = "Hello"
            };

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

            TestExpressionTracer.Validate(cast, new List <string> {
                errorMessage
            });
        }
コード例 #10
0
ファイル: New.cs プロジェクト: sunxiaotianmg/CoreWF
        public void ConstraintErrorForInvalidArguments()
        {
            TestNew <Complex> myNew = new TestNew <Complex>();

            myNew.Arguments.Add(new TestArgument <int>(Direction.In, "Real", 1));

            string error = string.Format(ErrorStrings.ConstructorInfoNotFound, typeof(Complex).Name);

            TestExpressionTracer.Validate(myNew, new List <string> {
                error
            });
        }
コード例 #11
0
        public void ConstraintErrorForValueTypeOperand()
        {
            TestFieldReference <TheStruct, int> fieldRef = new TestFieldReference <TheStruct, int>
            {
                Operand   = new TheStruct(),
                FieldName = "publicField"
            };

            string error = string.Format(ErrorStrings.TargetTypeIsValueType, typeof(FieldReference <TheStruct, int>).Name, fieldRef.DisplayName);

            TestExpressionTracer.Validate(fieldRef, new List <string> {
                error
            });
        }
コード例 #12
0
ファイル: GreaterThan.cs プロジェクト: sunxiaotianmg/CoreWF
        public void ConstraintViolatonInvalidExpression()
        {
            TestGreaterThan <PublicType, string, bool> greaterThan = new TestGreaterThan <PublicType, string, bool>
            {
                LeftExpression = context => new PublicType(),
                Right          = "1"
            };

            string error = TestExpressionTracer.GetExceptionMessage <PublicType, string, bool>(System.Linq.Expressions.ExpressionType.GreaterThan);

            TestExpressionTracer.Validate(greaterThan, new List <string> {
                error
            });
        }
コード例 #13
0
        public void ConstraintErrorForInvalidField()
        {
            TestFieldValue <PublicType, int> fieldVal = new TestFieldValue <PublicType, int>
            {
                OperandExpression = context => new PublicType(),
                FieldName         = "PublicProperty",
            };

            string error = string.Format(ErrorStrings.MemberNotFound, "PublicProperty", typeof(PublicType).Name);

            TestExpressionTracer.Validate(fieldVal, new List <string> {
                error
            });
        }
コード例 #14
0
        public void ConstraintErrorForEnumOperand()
        {
            TestFieldValue <WeekDay, WeekDay> field = new TestFieldValue <WeekDay, WeekDay>
            {
                Operand   = WeekDay.Monday,
                FieldName = "Monday"
            };

            string error = string.Format(ErrorStrings.TargetTypeCannotBeEnum, field.ProductActivity.GetType().Name, field.DisplayName);

            TestExpressionTracer.Validate(field, new List <string> {
                error
            });
        }
コード例 #15
0
ファイル: LessThanOrEqual.cs プロジェクト: jimitndiaye/corewf
        public void ConstraintViolatonInvalidExpression()
        {
            TestLessThanOrEqual <PublicType, string, bool> lessThanOrEqual = new TestLessThanOrEqual <PublicType, string, bool>
            {
                LeftExpression = context => new PublicType(),
                Right          = "1"
            };

            string error = TestExpressionTracer.GetExceptionMessage <PublicType, string, bool>(System.Linq.Expressions.ExpressionType.LessThanOrEqual);

            TestExpressionTracer.Validate(lessThanOrEqual, new List <string> {
                error
            });
        }
コード例 #16
0
        public void ConstraintErrorForInvalidField()
        {
            TestFieldReference <PublicType, int> fieldRef = new TestFieldReference <PublicType, int>
            {
                OperandExpression = context => new PublicType(),
                FieldName         = "!@$!@#%><?<?<*&^(*&^("
            };

            string error = string.Format(ErrorStrings.MemberNotFound, "!@$!@#%><?<?<*&^(*&^(", typeof(PublicType).Name);

            TestExpressionTracer.Validate(fieldRef, new List <string> {
                error
            });
        }
コード例 #17
0
        public void ConstraintErrorForEnumOperand()
        {
            TestFieldReference <WeekDay, int> fieldRef = new TestFieldReference <WeekDay, int>
            {
                Operand   = WeekDay.Monday,
                FieldName = "Monday"
            };

            List <string> errors = new List <string>
            {
                string.Format(ErrorStrings.TargetTypeCannotBeEnum, typeof(FieldReference <WeekDay, int>).Name, fieldRef.DisplayName)
            };

            TestExpressionTracer.Validate(fieldRef, errors);
        }
コード例 #18
0
        public void ConstraintErrorForEnumOperand()
        {
            WeekDay weekday = WeekDay.Monday;

            TestPropertyValue <WeekDay, int> propValue = new TestPropertyValue <WeekDay, int> {
                Operand = weekday, PropertyName = "Monday"
            };

            List <string> errors = new List <string>
            {
                string.Format(ErrorStrings.TargetTypeCannotBeEnum, propValue.ProductActivity.GetType().Name, propValue.DisplayName),
                string.Format(ErrorStrings.MemberNotFound, "Monday", typeof(WeekDay).Name)
            };

            TestExpressionTracer.Validate(propValue, errors);
        }
コード例 #19
0
        public void ConstraintViolationLeftNull()
        {
            TestAndAlso andAlso = new TestAndAlso
            {
                DisplayName = "Somename",
                Right       = false
            };

            andAlso.ProductAndAlso.Left = null;

            string error = string.Format(ErrorStrings.BinaryExpressionActivityRequiresArgument, "Left", "AndAlso", andAlso.DisplayName);

            TestExpressionTracer.Validate(andAlso, new List <string> {
                error
            });
        }