コード例 #1
0
        public void ConstraintErrorForFieldNameNull()
        {
            TestFieldValue <PublicType, int> fieldValue = new TestFieldValue <PublicType, int>
            {
                OperandExpression = context => new PublicType()
            };

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

            TestExpressionTracer.Validate(fieldValue, new List <string> {
                error
            });
        }
コード例 #2
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
            });
        }
コード例 #3
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
            });
        }
コード例 #4
0
        public void TryAccessingPropertyNotField()
        {
            TestFieldValue <PublicType, int> fieldVal = new TestFieldValue <PublicType, int>
            {
                OperandExpression = context => new PublicType(),
                FieldName         = "PublicProperty",
            };

            List <TestConstraintViolation> constraints = new List <TestConstraintViolation>();

            constraints.Add(new TestConstraintViolation(
                                string.Format(ErrorStrings.MemberNotFound, "PublicProperty", typeof(PublicType).Name),
                                fieldVal.ProductActivity));

            TestRuntime.ValidateWorkflowErrors(fieldVal, constraints, string.Format(ErrorStrings.MemberNotFound, "PublicProperty", typeof(PublicType).Name));
        }
コード例 #5
0
        public void TryGettingValueOfFieldNameNull()
        {
            TestFieldValue <PublicType, int> fieldValue = new TestFieldValue <PublicType, int>
            {
                OperandExpression = context => new PublicType()
            };

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

            List <TestConstraintViolation> constraints = new List <TestConstraintViolation>();

            constraints.Add(new TestConstraintViolation(
                                error,
                                fieldValue.ProductActivity));

            TestRuntime.ValidateWorkflowErrors(fieldValue, constraints, error);
        }
コード例 #6
0
        public void PassEnumTypeAsOperand()
        {
            TestFieldValue <WeekDay, WeekDay> field = new TestFieldValue <WeekDay, WeekDay>
            {
                Operand   = WeekDay.Monday,
                FieldName = "Monday"
            };

            List <TestConstraintViolation> constraints = new List <TestConstraintViolation>();

            constraints.Add(new TestConstraintViolation(
                                string.Format(ErrorStrings.TargetTypeCannotBeEnum, field.ProductActivity.GetType().Name, field.DisplayName),
                                field.ProductActivity));

            TestRuntime.ValidateWorkflowErrors(field,
                                               constraints,
                                               string.Format(ErrorStrings.TargetTypeCannotBeEnum, field.ProductActivity.GetType().Name, field.ProductActivity.DisplayName));
        }