13 [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
25 public string MethodName {
get;
private set; }
26 public string MessageOnFail {
get;
private set; }
30 MethodName = methodName;
31 MessageOnFail = messageOnError;
32 FailAction = failAction;
38 throw new NullReferenceException(
"Source cannot be null.");
40 MethodInfo m = source.GetType().GetMethod(MethodName);
42 throw new MissingMethodException(
"Method " + MethodName +
" not found in type " + source.GetType().ToString());
44 bool result = (bool)m.Invoke(source,
new System.Object[] { target });
48 messageOnFail =
string.Empty;
52 messageOnFail = MessageOnFail;