public SendCommandResult(SendCommandResultType type)
 {
     if (!IsSuccessType(type)) throw new ArgumentOutOfRangeException(nameof(type));
     if (!Enum.IsDefined(typeof (SendCommandResultType), type))
         throw new ArgumentOutOfRangeException(nameof(type));
     Type = type;
 }
 public SendCommandResult(SendCommandResultType type, Exception exception)
 {
     if (exception == null) throw new ArgumentNullException(nameof(exception));
     if (!Enum.IsDefined(typeof (SendCommandResultType), type))
         throw new ArgumentOutOfRangeException(nameof(type));
     if (type.IsNotOneOf(SendCommandResultType.ProcessingError, SendCommandResultType.PersistenceFailed)) throw new ArgumentOutOfRangeException(nameof(type));
     Type = type;
     Exception = exception;
 }
 public SendCommandResult(SendCommandResultType type, IEnumerable<KeyValuePair<string, string>> errors)
 {
     if (errors == null) throw new ArgumentNullException(nameof(errors));
     if (IsSuccessType(type)) throw new ArgumentOutOfRangeException(nameof(type));
     if (!Enum.IsDefined(typeof(SendCommandResultType), type))
         throw new ArgumentOutOfRangeException(nameof(type));
     Type = type;
     Errors = errors;
 }
 private static bool IsSuccessType(SendCommandResultType type)
 {
     return type.IsOneOf(SendCommandResultType.Accepted, SendCommandResultType.Completed);
 }