public void required_unique_email_returns_true_with_duplicate_emails_found_but_is_not_required() { // Arrange List<string> emailList = new List<string>(); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); bool requiredToBeUnique = false; // Act var rule = new RequireUniqueEmail(emailList, requiredToBeUnique); bool actual = rule.Validate(); // Assert Assert.IsTrue(actual); }
public void required_unique_email_returns_true_with_two_unique_emails() { // Arrange List<string> emailList = new List<string>(); emailList.Add("*****@*****.**"); emailList.Add("*****@*****.**"); bool requiredToBeUnique = true; // Act var rule = new RequireUniqueEmail(emailList, requiredToBeUnique); bool actual = rule.Validate(); // Assert Assert.IsTrue(actual); }
public void required_unique_email_returns_proper_error_message() { // Arrange // Act var rule = new RequireUniqueEmail(null, true); string actual = rule.ErrorMessage; // Assert Assert.AreEqual("There are duplicate email addresses when they are supposed to be unique.", actual); }