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 }); }
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 }); }
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 }); }
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)); }
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); }
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)); }