public static bool ValidEmail(this Customer customer) { return(AssertionConcern.IsValid( AssertionConcern.AssertArgumentLength(customer.Email, 5, 60, "Email deve possuir mais que 4 até 60 caracteres."), AssertionConcern.AssertArgumentNotEmpty(customer.Email, "Informe o email."), AssertionConcern.AssertArgumentMatches(@"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$", customer.Email, "Email inválido.") )); }
public override bool IsValid() { return(AssertionConcern.IsValid ( AssertionConcern.AssertArgumentNotEmpty(this.Email, "The email address is required."), AssertionConcern.AssertArgumentLength(this.Email, 1, 100, "Email address must be 100 characters or less."), AssertionConcern.AssertArgumentMatches(PATTERN, this.Email, "Email address format is invalid.") )); }
public Telefone(string nr_telefone) { if (string.IsNullOrEmpty(nr_telefone)) { return; } //AssertionConcern.AssertArgumentNotEmptyNotNull(nr_telefone, "Telefone Obrigatório"); //(xx) xxxxx-xxxx - sendo 8 ou 9 digitos AssertionConcern.AssertArgumentMatches(@"^\([1-9]{2}\) [2-9][0-9]{7,8}$", nr_telefone, "Formato do Número Telefone inválido"); //this.DDD = nr_telefone.Substring(1, 2); //this.NrTelefone = nr_telefone.Substring(5); this.NrTelefone = nr_telefone; }
public void Should_ThrowsAssertArgumentMatches() { AssertionConcern.AssertArgumentMatches(@"\d+", ExpectedString, ErrorMessage); }
public void Should_AssertArgumentMatches() { Assert.DoesNotThrow(() => AssertionConcern.AssertArgumentMatches(@"[a-z]+", ExpectedString, ErrorMessage)); }
protected void SelfAssertArgumentMatches(string pattern, string stringValue, string message) { AssertionConcern.AssertArgumentMatches(pattern, stringValue, message); }