public ActionResult LogOn(UserAuthentication value) { if (value == null) { throw new ArgumentNullException("value"); } value.Validate(); if (value.IsValid) { var user = this.UserService.GetBy(new UserEmailAddressSpecification(value.EmailAddress)); this.AuthenticationService.LogOn(user); ApplicationSession.Destroy(this.Session); var url = value.Redirect; if (base.Url.IsLocalUrl(url)) { return base.Redirect(url); } return base.RedirectToRoute(CommonRoutes.Index); } value.CopyToModel(ModelState); return base.View(Views.LogOn, value); }
public void Test_UserAuthentication_Validate() { var value = new UserAuthentication(); value.Validate(); Assert.AreEqual(2, value.Errors.Count, "Errors"); }