Esempio n. 1
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. 2
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());
        }