public ActionResult Edit(int id, FormCollection collection) { var model = new StoryFormModel(); var story = StoryRepository.StoryFetch(id); var project = ProjectRepository.ProjectFetch(story.ProjectId); this.Map(collection, story); story = StoryRepository.StorySave(story); if (story.IsValid) { return(this.RedirectToAction("Details", new { id = story.StoryId })); } model.Title = "Story Edit"; model.Story = story; model.Sprints = SprintRepository.SprintFetchInfoList(project); model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId); model.Users = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId); ModelHelper.MapBrokenRules(this.ModelState, story); return(this.View(model)); }
public static Story StoryAdd() { var story = StoryTestHelper.StoryNew(); story = StoryRepository.StorySave(story); return(story); }
public void Story_Fetch() { var story = StoryTestHelper.StoryNew(); story = StoryRepository.StorySave(story); story = StoryRepository.StoryFetch(story.StoryId); Assert.IsTrue(story != null, "Row returned should not equal null"); }
public void Story_Add() { var story = StoryTestHelper.StoryNew(); Assert.IsTrue(story.IsValid, "IsValid should be true"); story = StoryRepository.StorySave(story); Assert.IsTrue(story.StoryId != 0, "StoryId should be a non-zero value"); StoryRepository.StoryFetch(story.StoryId); }
public void Story_Edit() { var story = StoryTestHelper.StoryNew(); var description = story.Description; Assert.IsTrue(story.IsValid, "IsValid should be true"); story = StoryRepository.StorySave(story); story = StoryRepository.StoryFetch(story.StoryId); story.Description = DataHelper.RandomString(20); story = StoryRepository.StorySave(story); story = StoryRepository.StoryFetch(story.StoryId); Assert.IsTrue(story.Description != description, "Description should have different value"); }
public void Story_Delete() { var story = StoryTestHelper.StoryNew(); Assert.IsTrue(story.IsValid, "IsValid should be true"); story = StoryRepository.StorySave(story); story = StoryRepository.StoryFetch(story.StoryId); StoryRepository.StoryDelete(story.StoryId); try { StoryRepository.StoryFetch(story.StoryId); } catch (Exception ex) { Assert.IsTrue(ex.GetBaseException() is InvalidOperationException); } }