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)); }
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()); }
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()); }
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")); }
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")); }
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")); }
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()); }