public static Week WeekAdd() { var week = WeekTestHelper.WeekNew(); week = WeekRepository.WeekSave(week); return(week); }
public void Week_Fetch() { var week = WeekTestHelper.WeekNew(); week = WeekRepository.WeekSave(week); week = WeekRepository.WeekFetch(week.WeekId); Assert.IsTrue(week != null, "Row returned should not equal null"); }
public void Week_Add() { var week = WeekTestHelper.WeekNew(); Assert.IsTrue(week.IsValid, "IsValid should be true"); week = WeekRepository.WeekSave(week); Assert.IsTrue(week.WeekId != 0, "WeekId should be a non-zero value"); WeekRepository.WeekFetch(week.WeekId); }
public void Week_Edit() { var week = WeekTestHelper.WeekNew(); var name = week.StartDate; Assert.IsTrue(week.IsValid, "IsValid should be true"); week = WeekRepository.WeekSave(week); week = WeekRepository.WeekFetch(week.WeekId); week.StartDate = week.StartDate.AddDays(1); week = WeekRepository.WeekSave(week); week = WeekRepository.WeekFetch(week.WeekId); Assert.IsTrue(week.StartDate != name, "Name should have different value"); }
public ActionResult Edit(int id, FormCollection collection) { var model = new WeekEditModel(); var week = WeekRepository.WeekFetch(id); this.Map(collection, week); week = WeekRepository.WeekSave(week); if (week.IsValid) { return(this.RedirectToAction("Index", new { year = week.Year })); } model.Title = "Week Edit"; model.Week = week; ModelHelper.MapBrokenRules(this.ModelState, week); return(this.View(model)); }
public void Week_Delete() { var week = WeekTestHelper.WeekNew(); Assert.IsTrue(week.IsValid, "IsValid should be true"); week = WeekRepository.WeekSave(week); week = WeekRepository.WeekFetch(week.WeekId); WeekRepository.WeekDelete(week.WeekId); try { WeekRepository.WeekFetch(week.WeekId); } catch (Exception ex) { Assert.IsTrue(ex.GetBaseException() is InvalidOperationException); } }