示例#1
0
        public void SignUp_No_Initials_Clears_Existing()
        {
            var projectId = 3;
            var storyId = 4;
            var id = 5;
            var initials = "";
            var description = "Doin work (AA/FF)";
            var task = new Task {Description = description, Id = id, StoryId = storyId};

            var storyService = new Mock<IStoryProvider>();

            storyService.Setup(e => e.GetTask(projectId, storyId, id)).Returns(task);
            storyService.Setup(e => e.UpdateTask(task, projectId));

                var controller = new TaskController(storyService.Object);
                var result = controller.SignUp(initials, new[] { string.Format("{0}-{1}-{2}-{3}", projectId, storyId, id, 2) });
                var viewResult = result as RedirectToRouteResult;
                Assert.NotNull(viewResult);
                Assert.False(task.Description.Contains("(AA/FF)"));
            storyService.Verify();
        }
示例#2
0
        public void SignUp_Already_Has_Initials_NoParentheses()
        {
            var projectId = 3;
            var storyId = 4;
            var id = 5;
            var initials = "NN/GZ";
            var description = "Doin work AA/FF";
            var task = new Task {Description = description, Id = id, StoryId = storyId};

            var storyService = new Mock<IStoryProvider>();

            storyService.Setup(e => e.GetTask(projectId, storyId, id)).Returns(task);
            storyService.Setup(e => e.UpdateTask(task, projectId));

                var controller = new TaskController(storyService.Object);
                var result = controller.SignUp(initials, new[] { string.Format("{0}-{1}-{2}-{3}", projectId, storyId, id,3) });
                var viewResult = result as RedirectToRouteResult;
                Assert.NotNull(viewResult);
                Assert.True(task.Description.EndsWith("(NN/GZ)"));
                Assert.False(task.Description.Contains("AA/FF"));
            storyService.Verify();
        }
示例#3
0
        public void SignUp_Lowercase_Initials()
        {
            var projectId = 3;
            var storyId = 4;
            var id = 5;
            var initials = "nn/gz";
            var description = "Doin work";
            var task = new Task { Description = description, Id = id, StoryId = storyId};

            var storyService = new Mock<IStoryProvider>();

                storyService.Setup(e=>e.GetTask(projectId, storyId, id)).Returns(task);
                storyService.Setup(e=> e.UpdateTask(task, projectId));

                var controller = new TaskController(storyService.Object);
                var result = controller.SignUp(initials, new[] { string.Format("{0}-{1}-{2}-{3}", projectId, storyId, id,2) });
                var redirectResult = result as RedirectToRouteResult;
                Assert.NotNull(redirectResult);
                Assert.True(task.Description.EndsWith("(NN/GZ)"));
            storyService.Verify();
        }