示例#1
0
        private void DoneState(BacklogItem backlogItem)
        {
            // BR: Let's send every developer from the backlogItem a notification that their item is approved.

            var tempList = new List <Person>();

            if (backlogItem.GetTasks().Count >= 1)
            {
                foreach (var task in backlogItem.GetTasks())
                {
                    tempList.Add(task.GetAssignedPerson());
                }
            }

            if (backlogItem.GetAssignedPerson() != null)
            {
                tempList.Add(backlogItem.GetAssignedPerson());
            }

            // Send messages
            foreach (var involvedPerson in tempList)
            {
                involvedPerson.SendNotification($"Hi {involvedPerson.GetName()}, backlog item {backlogItem.GetName()} is done! Kudos!");
            }
        }
示例#2
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());
        }
示例#3
0
        private void DoingState(BacklogItem backlogItem)
        {
            var tempList = new List <Person>();

            if (backlogItem.GetTasks().Count >= 1)
            {
                foreach (var task in backlogItem.GetTasks())
                {
                    tempList.Add(task.GetAssignedPerson());
                }
            }

            if (backlogItem.GetAssignedPerson() != null)
            {
                tempList.Add(backlogItem.GetAssignedPerson());
            }

            // Send messages
            foreach (var involvedPerson in tempList)
            {
                involvedPerson.SendNotification($"Hi {involvedPerson.GetName()}, backlog item {backlogItem.GetName()} is in doing state.");
            }
        }
        public void NextState()
        {
            // BR: Only allow ready to test state when all tasks are active or done
            foreach (var task in _backlogItem.GetTasks())
            {
                if (task.GetState() != ETaskState.Done)
                {
                    throw new NotSupportedException(
                              "Backlog item can't go to testing because there are still tasks with todo or active status");
                }
            }

            _backlogItem.ChangeState(new TestingState(_backlogItem));
        }
示例#5
0
        public void NextState()
        {
            // BR: Only allow done state when all tasks are done.

            foreach (var task in _backlogItem.GetTasks())
            {
                if (task.GetState() != ETaskState.Done)
                {
                    throw new NotSupportedException(
                              "Can't set backlogItem state to done because not all tasks are done.");
                }
            }

            _backlogItem.ChangeState(new DoneState(_backlogItem));
        }