Esempio n. 1
0
        public void Set_Review_Should_Throw_SecurityException_In_FinishedState_When_Added_By_Someone_Else_But_ScrumMaster()
        {
            // 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 Peter", ERole.Tester);

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

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            sprint.GetState().ToNextState();

            Review review = new Review(sprint, p2, "Good work guys!");

            // Act

            // Assert
            Assert.Throws <SecurityException>(() => project.GetSprints().First().GetState().SetReview(review));
        }
Esempio n. 2
0
        public void Adding_Developer_Should_Not_Throw_Exception_In_ActiveState()
        {
            // 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 Peter", ERole.Tester);
            Person p3 = new Person("Dick Bruna", ERole.Developer);

            ISprint sprint = factory.MakeReleaseSprint("Sprint 1", DateTime.Parse("2010-10-10T00:00:00Z"), DateTime.Parse("2010-10-10T00:00:00Z").AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();

            // Act
            sprint.GetState().AddDeveloper(p3);


            // Assert
            Assert.Contains(p3, sprint.GetDevelopers());
        }
Esempio n. 3
0
        public void Changing_To_Previous_State_Should_Not_Throw_Exception_In_FinishedState()
        {
            // 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 Peter", ERole.Tester);

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

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            sprint.GetState().ToNextState();

            // Act
            project.GetSprints().First().GetState().ToPreviousState();


            // Assert
            Assert.Equal("ActiveState", project.GetSprints().First().GetState().GetType().Name);
        }
Esempio n. 4
0
        public void Adding_Developer_Should_Throw_NotSupportedException_In_FinishedState()
        {
            // 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 Peter", ERole.Tester);
            Person p3 = new Person("Dick Bruna", ERole.Developer);

            ISprint sprint = factory.MakeReviewSprint("Sprint 1", DateTime.Parse("2010-10-10T00:00:00Z"), DateTime.Parse("2010-10-10T00:00:00Z").AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            sprint.GetState().ToNextState();

            // Act

            // Assert
            Assert.Throws <NotSupportedException>(() => project.GetSprints().First().GetState().AddDeveloper(p3));
            Assert.DoesNotContain(p3, sprint.GetDevelopers());
        }
Esempio n. 5
0
        public void Changing_EndDate_Should_Throw_NotSupportedException_In_FinishedState()
        {
            // 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 Peter", ERole.Tester);

            ISprint sprint = factory.MakeReleaseSprint("Sprint 1", DateTime.Parse("2010-10-10T00:00:00Z"), DateTime.Parse("2010-10-10T00:00:00Z").AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            sprint.GetState().ToNextState();
            // Act

            // Assert
            Assert.Throws <NotSupportedException>(() => project.GetSprints().First().GetState().SetEndDate(DateTime.Parse("2010-10-17T00:00:00Z")));
        }
Esempio n. 6
0
        public void TestPipeline_Should_Fire_When_ReviewSprint_Reaches_FinishedState()
        {
            // 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 Peter", ERole.Tester);

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

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            sprint.GetState().ToNextState();

            // Act
            sprint.GetState().StartStateAction();
            // Assert
        }
Esempio n. 7
0
        public void Changing_SprintName_Should_Throw_NotSupportedException_In_ActiveState()
        {
            // 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 Peter", ERole.Tester);

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

            project.AddSprint(sprint);
            sprint.GetState().ToNextState();
            // Act
            // Assert
            Assert.Throws <NotSupportedException>(() => project.GetSprints().First().GetState().SetName("Foo"));
        }
Esempio n. 8
0
        public void Changing_SprintName_Should_Not_Throw_Exception_In_InitializedState()
        {
            // 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 Peter", ERole.Tester);

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

            project.AddSprint(sprint);
            // Act

            sprint.GetState().SetName("foo");

            // Assert
            Assert.Equal("foo", project.GetSprints().First().GetName());
        }
Esempio n. 9
0
        public void Changing_EndDate_Should_Not_Throw_Exception_In_InitializedState()
        {
            // 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 Peter", ERole.Tester);

            ISprint sprint = factory.MakeReviewSprint("Sprint 1", DateTime.Parse("2010-10-10T00:00:00Z"), DateTime.Parse("2010-10-10T00:00:00Z").AddDays(14), project, p1, new List <Person>()
            {
                p2
            });

            project.AddSprint(sprint);
            // Act

            sprint.GetState().SetEndDate(DateTime.Parse("2010-10-10T00:00:00Z").AddDays(7));


            // Assert
            Assert.Equal(DateTime.Parse("2010-10-17T00:00:00Z"), project.GetSprints().First().GetEndDate());
        }