Пример #1
0
        public void Backlog_Can_Unregister_Observer()
        {
            // 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
            backlogItem.Register(backlogItemObserver);
            backlogItem.Unregister(backlogItemObserver);

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