public void ValidatePassword(string password) { string passwordPattern = "^(?=.*[A-Z])(?=.*[0-9])(?=.*[^0-9a-zA-Z])(?!.*[^0-9a-zA-Z].*[^0-9a-zA-Z]).{8,}$"; try { bool actual = ValidateDetails.IsValid(password, passwordPattern); Assert.AreEqual(true, actual); } catch (CustomException e) { Assert.AreEqual("Exception : Invalid details", e.Message); } }
public void ValidateEmail(string email) { string emailPattern = "^[a-zA-Z]+([.+_-][a-zA-Z0-9]+)*@[a-zA-Z0-9]+[.][a-zA-Z]+([.][a-zA-Z]{2})?$"; try { bool actual = ValidateDetails.IsValid(email, emailPattern); Assert.AreEqual(true, actual); } catch (CustomException e) { Assert.AreEqual("Exception : Invalid details", e.Message); } }
public void ValidateMobileNumber(string mobileNumber) { string mobileNumberPattern = "^[0-9]{2}[ ][0-9]{10}$"; try { bool actual = ValidateDetails.IsValid(mobileNumber, mobileNumberPattern); Assert.AreEqual(true, actual); } catch (CustomException e) { Assert.AreEqual("Exception : Invalid details", e.Message); } }
public void ValidateLastName(string lastName) { string lastNamePattern = @"^[A-Z]{1}[a-zA-Z]{2,}$"; try { bool actual = ValidateDetails.IsValid(lastName, lastNamePattern); Assert.AreEqual(true, actual); } catch (CustomException e) { Assert.AreEqual("Exception : Invalid details", e.Message); } }