Ejemplo n.º 1
0
        public void CurrentIteration()
        {
            int projectId = 3;
            var storyService = new Mock<IStoryProvider>();

            storyService.Setup(e => e.GetStories(It.Is<long>(je => je == 3), IterationType.Current)).Returns(new List<Story>());

            var controller = new StoriesController(storyService.Object);
            var result = controller.CurrentIteration(projectId);
            var viewResult = result as ViewResult;
            Assert.NotNull(viewResult);
            Assert.IsInstanceOf<ProjectStoryViewModel>(viewResult.Model);
            storyService.Verify();
        }
Ejemplo n.º 2
0
        public void Get()
        {
            int projectId = 3;
            int storyId = 5;
            var storyService = new Mock<IStoryProvider>();

            var story = new Story();
            IterationType iterationType = IterationType.Backlog;
            storyService.Setup(e => e.GetStory(It.Is<long>(je => je == projectId), It.Is<long>(je => je == storyId), iterationType)).Returns(story);

            var controller = new StoriesController(storyService.Object);
            var result = controller.Get(projectId, storyId, (int)iterationType);
            var viewResult = result as PartialViewResult;
            Assert.NotNull(viewResult);
            Assert.IsInstanceOf<StoryRowViewModel>(viewResult.Model);
            Assert.AreEqual(((StoryRowViewModel)viewResult.Model).Story, story);
            storyService.Verify();
        }
Ejemplo n.º 3
0
        public void Finish()
        {
            var storyService = new Mock<IStoryProvider>();

            var storyId = 1;
            var projectId = 3;

            var anotherStory = new Story() { Status = StoryStatus.Finished };

            IterationType iterationType = IterationType.Undefined;
            storyService.Setup(e => e.FinishStory(projectId, storyId, iterationType)).Returns(anotherStory);
            var controller = new StoriesController(storyService.Object);
            var result = controller.Finish(projectId, storyId, (int)iterationType);
            var viewResult = result as PartialViewResult;
            Assert.NotNull(viewResult);
            Assert.IsInstanceOf<StoryRowViewModel>(viewResult.Model);
            Assert.AreEqual(((StoryRowViewModel)viewResult.Model).Story, anotherStory);
            storyService.Verify();
        }