Esempio n. 1
0
        public void Adding_Same_Commit_To_Source_Should_Throw_NotSupportedException()
        {
            // Arrange
            var p1 = new Person("Bas", ERole.Lead);
            var p2 = new Person("Tom", ERole.Developer);

            var project = new Project("AvansDevOps", p1);
            var source  = new Source("AvansDevOps_Web");

            project.AddSource(source);

            var backlog = new Backlog(project);

            project.AddBacklog(backlog);

            backlog.AddBacklogItem(new BacklogItem("User should be able to log into the web interface", "foo", p2, 3, backlog));

            // Act
            var factory = new CommitFactory();
            var commit  = factory.MakeCommit("Adding login section to website", "Reference to backlogItem",
                                             project.GetBacklog().GetBacklogItems().Find(backlogItem => backlogItem.GetDescription() == "foo"));

            project.GetSources().First().AddCommit(commit);


            // Assert
            Assert.Contains(commit, project.GetSources().First().GetCommits());
            Assert.Throws <NotSupportedException>(() => project.GetSources().First().AddCommit(commit));
        }
Esempio n. 2
0
        public void Deleting_An_Existing_Source_From_A_Project_Should_Not_Throw_Exception()
        {
            // Arrange
            var p1 = new Person("Bas", ERole.Lead);
            var p2 = new Person("Tom", ERole.Developer);

            var project = new Project("AvansDevOps", p1);
            var source  = new Source("AvansDevOps_Web");

            project.AddSource(source);

            var backlog = new Backlog(project);

            project.AddBacklog(backlog);

            backlog.AddBacklogItem(new BacklogItem("User should be able to log into the web interface", "foo", p2, 3, backlog));

            // Act
            var factory = new CommitFactory();
            var commit  = factory.MakeCommit("Adding login section to website", "Reference to backlogItem",
                                             project.GetBacklog().GetBacklogItems().Find(backlogItem => backlogItem.GetDescription() == "foo"));

            project.GetSources().First().AddCommit(commit);


            // Assert
            project.RemoveSource(source);
            Assert.Empty(project.GetSources());
        }
Esempio n. 3
0
        public void Notification_Todo_State_Update()
        {
            // Arrange
            Project        project = new Project("Test Project", new Person("Bas", ERole.Lead));
            SprintFactory  factory = new SprintFactory();
            ChannelFactory channel = new ChannelFactory();

            Person p1 = new Person("Tom", ERole.Developer);
            Person p2 = new Person("Jan Roos", ERole.Developer);

            p1.AddChannel(channel.CreateSlackChannel("@tom"));

            ISprint sprint = factory.MakeReleaseSprint("Sprint 1", DateTime.Now, DateTime.Now.AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);

            var backlog = new Backlog(project);

            var backlogItem = new BacklogItem("User can login into the platform", "Foo", p2, 3, backlog);

            backlogItem.AssignPerson(p2);
            backlog.AddBacklogItem(backlogItem);

            sprint.AddToSprintBacklog(backlogItem);

            project.AddBacklog(backlog);

            var task1 = new Task("Bar", p1);

            backlogItem.GetState().AddTask(task1);

            var backlogItemObserver = new BacklogItemObserver();

            // Act
            backlogItem.Register(backlogItemObserver);
            backlogItem.GetState().NextState();
            // Backlog is in DoingState, set tasks

            backlogItem.GetTasks().First().NextState();
            backlogItem.GetTasks().First().NextState();

            task1.NextState();
            task1.NextState();

            backlogItem.GetState().NextState();
            backlogItem.GetState().NextState();

            // Backlog is in TestingState
            backlogItem.GetState().NextState();

            // Assert
            Assert.NotEmpty(backlogItem.GetObservers());
        }
Esempio n. 4
0
        public void ProgressTest()
        {
            //arrange
            Mock <Sprint> sprint = new Mock <Sprint>();

            Backlog backlog = new Backlog(sprint.Object);

            BacklogItem headItem = new BacklogItem("Desc");

            backlog.AddBacklogItem(headItem);

            //act
            headItem.Progress();

            //assert

            Assert.IsTrue(headItem.state.GetType().Equals("doing"));
        }
Esempio n. 5
0
        public void CheckSetBackHeadItem()
        {
            //arrange
            Mock <Sprint> sprint = new Mock <Sprint>();

            Backlog backlog = new Backlog(sprint.Object);

            BacklogItem headItem = new BacklogItem("Desc");

            backlog.AddBacklogItem(headItem);

            //act
            headItem.Progress();
            headItem.state.SetBack();

            //assert
            Assert.IsTrue(headItem.state.GetType().Equals("todo"));
        }
Esempio n. 6
0
        public void CheckNotDoneHeadItemIfSubItemsAreNotDone()
        {
            //arrange
            Mock <Sprint> sprint = new Mock <Sprint>();

            Backlog backlog = new Backlog(sprint.Object);

            BacklogItem headItem = new BacklogItem("Desc");
            BacklogItem subItem  = new BacklogItem("sub");

            backlog.AddBacklogItem(headItem);
            headItem.AddSubItem(subItem);

            //act
            headItem.Progress();
            headItem.Progress();

            //assert
            Assert.IsFalse(headItem.state.GetType().Equals("done"));
        }
Esempio n. 7
0
        public void Backlog_Can_Register_Multiple_Observers()
        {
            // Arrange
            Project       project = new Project("Test Project", new Person("Bas", ERole.Lead));
            SprintFactory factory = new SprintFactory();

            Person p1 = new Person("Tom", ERole.Developer);
            Person p2 = new Person("Jan Roos", ERole.Developer);

            ISprint sprint = factory.MakeReleaseSprint("Sprint 1", DateTime.Now, DateTime.Now.AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);

            var backlog = new Backlog(project);

            var backlogItem = new BacklogItem("User can login into the platform", "Foo", p2, 3, backlog);

            backlogItem.AssignPerson(p2);
            backlog.AddBacklogItem(backlogItem);

            sprint.AddToSprintBacklog(backlogItem);

            project.AddBacklog(backlog);

            var task1 = new Task("Bar", p1);

            backlogItem.GetState().AddTask(task1);

            var backlogItemObserver = new BacklogItemObserver();

            // Act
            // TODO: Add sprint observer
            backlogItem.Register(backlogItemObserver);

            // Assert
            Assert.Single(backlogItem.GetObservers());
        }