示例#1
0
 public void AssertNotDuplicateOf(IAmField otherConstant)
 {
     if (!HasTheSameNameAs(otherConstant))
     {
         if (HasTheSameValueAs(otherConstant))
         {
             var builder = new StringBuilder();
             AddNameTo(builder);
             builder.Append(" is a duplicate of ");
             otherConstant.AddNameTo(builder);
             throw new DuplicateConstantException(builder.ToString());
         }
     }
 }
示例#2
0
 private bool HasTheSameValueAs(IAmField otherConstant)
 {
     return(otherConstant.HasValue(_fieldInfo.GetValue(null)));
 }
示例#3
0
 private bool HasTheSameNameAs(IAmField otherConstant)
 {
     return(otherConstant.HasName(_fieldInfo.Name));
 }