private bool IsValidDocumentNumber(string documentNumber) { const int cnpjSize = 14; const int cpfSize = 11; if (documentNumber.All(char.IsDigit)) { IIdentificationDocument identificationDocument = null; if (documentNumber.Length == cpfSize) { identificationDocument = new CpfValidator(); } else if (documentNumber.Length == cnpjSize) { identificationDocument = new CnpjValidator(); } else { identificationDocument = new NullDocumentValidator(); } return(identificationDocument.IsValid(documentNumber)); } else { return(false); } }
public void AddDocument(IIdentificationDocument document) { }