public void Story_Create() { var story = StoryRepository.StoryNew(); Assert.IsTrue(story.IsNew, "IsNew should be true"); Assert.IsTrue(story.IsDirty, "IsDirty should be true"); Assert.IsFalse(story.IsValid, "IsValid should be false"); Assert.IsTrue(story.IsSelfDirty, "IsSelfDirty should be true"); Assert.IsFalse(story.IsSelfValid, "IsSelfValid should be false"); Assert.IsTrue( ValidationHelper.ContainsRule(story, DbType.Int32, "CategoryId"), "CategoryId should be required"); Assert.IsTrue( ValidationHelper.ContainsRule(story, DbType.String, "Description"), "Description should be required"); Assert.IsTrue( ValidationHelper.ContainsRule(story, DbType.Int32, "ProjectId"), "ProjectId should be required"); Assert.IsTrue( ValidationHelper.ContainsRule(story, DbType.Int32, "StatusId"), "StatusId should be required"); }
public ActionResult Create(int projectId, int?sprintId, FormCollection collection) { var model = new StoryFormModel(); var story = StoryRepository.StoryNew(); var project = ProjectRepository.ProjectFetch(projectId); story.ProjectId = projectId; story.SprintId = sprintId ?? 0; this.Map(collection, story); story = StoryRepository.StorySave(story); if (story.IsValid) { return(this.RedirectToAction("Details", new { id = story.StoryId })); } model.Title = "Story Create"; 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 StoryNew() { var project = ProjectTestHelper.ProjectAdd(); var status = StatusTestHelper.StatusAdd(); var story = StoryRepository.StoryNew(); story.Description = DataHelper.RandomString(50); story.ProjectId = project.ProjectId; story.StatusId = status.StatusId; return(story); }
public ActionResult Create(int projectId, int?sprintId) { var model = new StoryFormModel(); var story = StoryRepository.StoryNew(); var project = ProjectRepository.ProjectFetch(projectId); story.ProjectId = projectId; story.SprintId = sprintId ?? 0; model.Title = "Story Create"; model.Story = story; model.Sprints = SprintRepository.SprintFetchInfoList(project); model.Statuses = StatusRepository.StatusFetchInfoList(story.ProjectId); model.Users = ProjectUserRepository.ProjectUserFetchInfoList(story.ProjectId); return(this.View(model)); }