public void Update_WhenCalled_TermIsUpdate() { // arrange var expected = new List <Term> { FakeTermRepository.spring2016, FakeTermRepository.spring2017, FakeTermRepository.fall2017 }; var toUpdate = FakeTermRepository.fall2016; toUpdate.Name = "Summer 2016"; expected.Add(toUpdate); // act _termService.Update(toUpdate); // assert Assert.AreEqual(expected, FakeTermRepository.terms); }
public ActionResult EditTerm(Guid termid, Termlang lang, Guid Uuid) { Term term = termService.GetByID(termid); if (TryUpdateModel(lang, new string[] { "title", "contents" }) && ModelState.IsValid) { term.Uuid = Guid.NewGuid(); termService.Update(term); termService.SaveChanges(); termlangService.Update(lang); termlangService.SaveChanges(); return(RedirectToAction("Term")); } else { ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator."); return(View(lang)); } }