Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public static Story StoryAdd()
        {
            var story = StoryTestHelper.StoryNew();

            story = StoryRepository.StorySave(story);

            return(story);
        }
Ejemplo n.º 3
0
        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");
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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");
        }
Ejemplo n.º 6
0
        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);
            }
        }