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