Exemplo n.º 1
0
 public void IfIsNotValidEnum(Type enumType, object argument, string argumentName, string message = null)
 {
     if (!EnumerationValidator.Validate(enumType, argument))
     {
         var exceptionMsg = message ?? string.Format(DefaultIfIsNotValidEnumMessage, argument, enumType.Name);
         throw new ArgumentException(exceptionMsg, argumentName);
     }
 }
Exemplo n.º 2
0
 public void IfIsNotValidEnum <TEnum>(TEnum?argument, string argumentName, string message = null)
     where TEnum : struct
 {
     if (!EnumerationValidator.Validate(argument))
     {
         var exceptionMsg = message ?? string.Format(DefaultIfIsNotValidEnumMessage, argument, typeof(TEnum).Name);
         throw new ArgumentException(exceptionMsg, argumentName);
     }
 }
 public GivenEnumerationValidator()
 {
     _validator    = new EnumerationValidator <Foo>("InvalidEnum");
     _propertyRule = new PropertyRule(null, null, null, null, null, null);
 }