//[ValidateAntiForgeryToken] public ActionResult AddTime(Time time) { if (ModelState.IsValid) { // Save time to DB repository.AddTime(time); // Send email notification // TODO: set this up as an asynchronous process that we don't need to wait for var user = repository.GetUser(time.UserId); EmailManager.Send(user.Manager.Email, time); return(RedirectToAction("Index")); } return(View(time)); }
public void GetUser_Success() { // Setup TimesheetContext db = new TimesheetContext(); User user = db.Users.First(); // Test action TimesheetRepository repository = new TimesheetRepository(); var authenticatedUser = repository.GetUser(user.Login, user.Password); // Assertions Assert.IsNotNull(authenticatedUser); Assert.AreEqual(user.Login, authenticatedUser.Login); }