public void KnowIfEmailIsCorrectlyFormatted() { const string incorrectMail1 = "maildomaine.com"; const string incorrectMail2 = "mail@domainecom"; const string incorrectMail3 = "maildomainecom"; const string incorrectMail4 = "m\\ail@dom8/aine.com"; const string correctMail = "*****@*****.**"; Contact contact = new Contact() { FullName = FullName, Phone = Phone, }; contact.Mail = incorrectMail1; Assert.IsFalse(contact.IsValid()); contact.Mail = incorrectMail2; Assert.IsFalse(contact.IsValid()); contact.Mail = incorrectMail3; Assert.IsFalse(contact.IsValid()); contact.Mail = incorrectMail4; Assert.IsFalse(contact.IsValid()); contact.Mail = correctMail; Assert.IsTrue(contact.IsValid()); }
public void KnowIfContactIsValid() { Contact contact = new Contact { FullName = FullName, Phone = Phone, Mail = Mail }; Assert.IsTrue(contact.IsValid()); contact = new Contact { FullName = FullName, Phone = Phone }; Assert.IsFalse(contact.IsValid()); contact = new Contact { FullName = FullName, Mail = Mail }; Assert.IsFalse(contact.IsValid()); contact = new Contact { Phone = Phone, Mail = Mail }; Assert.IsFalse(contact.IsValid()); }
public PartialViewResult SignIn(Contact contact) { if (contact.IsValid()) { if (!ContactRepository.EmailAlreadyExists(contact.Mail.Trim())) { contact.ConfirmNumber = Guid.NewGuid(); contact.IsConfirmed = false; ContactRepository.Save(contact); //ViewBag.SigInNotification = "Un email vient de vous être envoyé. Vous devez suivre le lien présent dans ce mail afin de valider votre inscription"; SessionHelper.GetInstance().CurrentUser = contact; return PartialView("/Views/RendezVous/Index.cshtml", GetHolidays()); } ViewBag.SignInError = SignInResource.EmailAlreadyExists; } return PartialView("SignIn", contact); }