public void RestorePasswordNonExistingTest() { var model = new RestorePasswordModel { Username = "******", Email = "*****@*****.**" }; // Trying to restore password of non existing user. this.tests.Storage.RestorePassword(model); }
public void RestorePasswordSuccess() { var model = new RestorePasswordModel { Email = "*****@*****.**" }; var password = _Tests.DataContext.Users.Where(u => u.Username == "panza").Single().Password; _Tests.Storage.RestorePassword(model); var newpassword = _Tests.DataContext.Users.Where(u => u.Username == "panza").Single().Password; Assert.IsTrue(newpassword != password); }
public void RestorePasswordExisting() { var model = new RestorePasswordModel {Username = "******", Email = "*****@*****.**" }; var password = this.tests.DataContext.Users.Single(u => u.Username == "panza").Password; this.tests.Storage.RestorePassword(model); var newpassword = this.tests.DataContext.Users.Single(u => u.Username == "panza").Password; Assert.IsTrue(newpassword != password); }
public void RestorePasswordSuccess() { var model = new RestorePasswordModel { Email = "*****@*****.**" }; var password = _Tests.DataContext.Users.Where(u => u.Username == "panza").Single().Password; _Tests.Storage.RestorePassword(model); _Tests.MockStorage.Verify(u => u.SendEmail(It.IsAny<string>(), It.Is<string>(s => s == "*****@*****.**"), It.IsAny<string>(), It.IsAny<string>()), Times.Once()); var newpassword = _Tests.DataContext.Users.Where(u => u.Username == "panza").Single().Password; Assert.IsTrue(newpassword != password); }
public void RestorePasswordExistingTest() { var model = new RestorePasswordModel {Username = "******", Email = "*****@*****.**" }; // Getting old password. var password = this.tests.DataContext.Users.Single(u => u.Username == "panza").Password; this.tests.Storage.RestorePassword(model); // Getting new password. var newpassword = this.tests.DataContext.Users.Single(u => u.Username == "panza").Password; // Verifying if new and old passwords are not equal. Assert.AreNotEqual(newpassword, password); }
public ActionResult Forgot(RestorePasswordModel restorePasswordModel) { var user = _Storage.GetUser(u => u.Email == restorePasswordModel.Email); if (user == null) { ModelState.AddModelError("Email", "No user with such email"); } if (!ModelState.IsValid) { return View(restorePasswordModel); } _Storage.RestorePassword(restorePasswordModel); return View("ForgotSent"); }
public void RestorePasswordNonExisting() { var model = new RestorePasswordModel {Email = "*****@*****.**"}; _Tests.Storage.RestorePassword(model); }
public void RestorePasswordNonExisting() { var model = new RestorePasswordModel { Username = "******", Email = "*****@*****.**" }; this.tests.Storage.RestorePassword(model); }
public ActionResult Forgot(RestorePasswordModel restorePasswordModel) { var user = this.storage.GetUser(u => u.Username == restorePasswordModel.Username && u.Email == restorePasswordModel.Email); if (user == null) { this.ModelState.AddModelError("NotFound", "User with such username and email combination not found"); } if (!this.ModelState.IsValid) { return View(restorePasswordModel); } this.storage.RestorePassword(restorePasswordModel); return this.View("ForgotSent"); }