private static IList<Task> GetOldTasks()
        {
            IList<Task> oldTasks = new List<Task>();

            Task task1 = new Task
            {
                Name = "Task 1",
                Status = "In progress",
                SystemId = "1",
                WorkEffortEstimate = 30
            };
            Task task2 = new Task
            {
                Name = "Task 2",
                Status = "In progress",
                SystemId = "2",
                WorkEffortEstimate = 20
            };

            task1.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(25, new DateTime(2009, 7, 6)));
            task2.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(15, new DateTime(2009, 7, 6)));
            task1.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(20, new DateTime(2009, 7, 7)));
            task2.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(10, new DateTime(2009, 7, 7)));
            oldTasks.Add(task1);
            oldTasks.Add(task2);

            SetParentsforTasks(oldTasks);

            return oldTasks;
        }
Example #2
0
        public Task ParseTaskWithData()
        {
            XmlNode taskNode = xmlDocument["Task"];

            var task = new Task();
            XmlNode taskName = taskNode.Attributes.GetNamedItem("refObjectName");
            XmlElement taskEstimateNode = xmlDocument["Task"]["Estimate"];
            XmlElement taskStateNode = xmlDocument["Task"]["State"];
            XmlElement creationDateNode = xmlDocument["Task"]["CreationDate"];
            XmlElement idNode = xmlDocument["Task"]["ObjectID"];

            task.Name = GetStringValueFromNode(taskName);
            task.WorkEffortEstimate = GetIntValueFromNode(taskEstimateNode);
            task.Status = GetStringValueFromNode(taskStateNode);
            task.SystemId = GetStringValueFromNode(idNode);
            
            var workEffortHistoryItem = new WorkEffortHistoryItem(
                GetIntValueFromNode(taskEstimateNode), GetDateFromXmlNode(creationDateNode));

            task.AddWorkEffortHistoryItem(workEffortHistoryItem);

            return task;
        }
        protected static List<ProjectInfoServer> GetMockProjects()
        {
            var iterationStartDate = new DateTime(2009, 7, 28);
            var iterationEndDate = new DateTime(2009, 8, 9);

            var task1 = new Task
            {
                Status = "Defined",
                Name = "Task1",
                WorkEffortEstimate = 10,
                SystemId = "t1 sys ID"
            };
            var task2 = new Task
            {
                Status = "In-Progress",
                Name = "Task2",
                WorkEffortEstimate = 20,
                SystemId = "t2 sys ID"
            };
            var task3 = new Task
            {
                Status = "In-Progress",
                Name = "Task3",
                WorkEffortEstimate = 30,
                SystemId = "t3 sys ID"
            };
            var task4 = new Task
            {
                Status = "Completed",
                Name = "Task4",
                WorkEffortEstimate = 40,
                SystemId = "t4 sys ID"
            };

            List<Task> tasks = new List<Task>();
            tasks.Add(task1);
            tasks.Add(task2);
            tasks.Add(task3);
            tasks.Add(task4);

            tasks[0].AddWorkEffortHistoryItem(new WorkEffortHistoryItem(2, new DateTime(2009, 7, 31)));
            tasks[1].AddWorkEffortHistoryItem(new WorkEffortHistoryItem(5, new DateTime(2009, 7, 31)));
            tasks[2].AddWorkEffortHistoryItem(new WorkEffortHistoryItem(15, new DateTime(2009, 7, 31)));
            tasks[3].AddWorkEffortHistoryItem(new WorkEffortHistoryItem(25, new DateTime(2009, 7, 31)));

            Iteration iteration = new Iteration
            {
                EndDate = iterationEndDate,
                Name = "Sprint 3",
                StartDate = iterationStartDate,
                SystemId = "iteration sys ID"
            };
            iteration.Tasks = tasks;

            Project mockProject = new Project
            {
                Name = "Smeedee",
                SystemId = "project sys ID"
            };

            mockProject.AddIteration(iteration);

            var server = new ProjectInfoServer("Mock server", "http://mock.url");
            server.AddProject(mockProject);
            
            return new List<ProjectInfoServer>{server};
        }
        private static IList<Task> GetNewTasks()
        {
            IList<Task> newTasks = new List<Task>();
            
            Task task2 = new Task
            {
                Name = "Task 2",
                Status = "Completed",
                SystemId = "2",
                WorkEffortEstimate = 20
            };
            Task task3 = new Task
            {
                Name = "Task 3",
                Status = "In progress",
                SystemId = "3",
                WorkEffortEstimate = 15
            };

            task2.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(15, new DateTime(2009, 7, 6)));
            task2.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(10, new DateTime(2009, 7, 7)));
            task2.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(0, new DateTime(2009, 7, 8)));
            task3.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(12, new DateTime(2009, 7, 8)));
            newTasks.Add(task2);
            newTasks.Add(task3);

            SetParentsforTasks(newTasks);

            return newTasks;
        }
        private void AssertTask(Task actual, Task expected)
        {
            Console.WriteLine("AssertTask");

            actual.ShouldNotBeNull();

            actual.Iteration.ShouldNotBeNull();
            actual.Iteration.SystemId.ShouldBe(expected.Iteration.SystemId);

            actual.SystemId.ShouldBe(expected.SystemId);
            actual.Status.ShouldBe(expected.Status);
            actual.Name.ShouldBe(expected.Name);
            actual.WorkEffortEstimate.ShouldBe(expected.WorkEffortEstimate);
        }
Example #6
0
 public virtual void AddTask(Task newTask)
 {
     newTask.Iteration = this;
     internalTasks.Add(newTask);
     Tasks = internalTasks;
 }
Example #7
0
        private List<Task> ConvertWorkItemsToTasks(IEnumerable workItems)
        {
            var tasks = new List<Task>();

            foreach (WorkItem workItem in workItems)
            {
                var remainingWork = ParseFieldToInt(workItem.Fields[WORK_REMAINING_FIELD]);
                var estimatedWork = ParseFieldToInt(workItem.Fields[ESTIMATED_EFFORT_FIELD]);

                // NOTE: We have at least one corner case here.. What if someone changes a name as part of a revision?
                if (!tasks.Select((t) => t.Name).Contains(workItem.Title))
                {
                    var task = new Task
                                   {
                                       SystemId = workItem.Id.ToString(),
                                       Name = workItem.Title,
                                       Status = workItem.State,
                                       WorkEffortEstimate = estimatedWork
                                   };

                    tasks.Add(task);
                }

                // NOTE: To naive?
                // We add the WorkEffortHistoryItem to the first task we can find with the same name.
                var taskToAddTo = tasks.Where((t) => t.Name == workItem.Title).First();
                taskToAddTo.AddWorkEffortHistoryItem(new WorkEffortHistoryItem(remainingWork, workItem.ChangedDate));
                taskToAddTo.WorkEffortEstimate = estimatedWork;
            }

            return tasks;
        }
Example #8
0
        public void should_be_able_to_get_WorkEffortEstimateForTasks()
        {
            
            Scenario.StartNew(this, scenario =>
            {
                scenario.Given(an_iteration_has_been_created).And("it has tasks");
                scenario.When("remaining workeffort for iteration is requested");
                scenario.Then("the sum of every tasks workeffort should be returned", ()=>
                {
                    var task1 = new Task();
                    task1.WorkEffortEstimate = 20;
                    iteration.AddTask(task1);

                    var task2 = new Task();
                    task2.WorkEffortEstimate = 30;
                    iteration.AddTask(task2);

                    iteration.GetWorkEffortEstimateForTasks().ShouldBe(50);

                });
            });
        }
Example #9
0
        public void should_set_Iteration_reference_on_Task()
        {
            Scenario.StartNew(this, scenario =>
            {
                scenario.Given(iteration_has_been_created);

                scenario.When("a Task is added");

                scenario.Then(
                    "the Iteration property on the Task object should point to the current Iteration", () =>
                    {
                        var task = new Task();
                        iteration.AddTask(task);

                        task.Iteration.Name.ShouldBe(iteration.Name);
                    });
            });
        }
Example #10
0
        public void should_be_able_to_add_Tasks()
        {
            Scenario.StartNew(this, scenario =>
            {
                scenario.Given(iteration_has_been_created)
                    .And(project_and_projectInfoServer_has_been_created)
                        .And(project_is_added_to_server)
                            .And(iteration_is_added_to_project);

                scenario.When("a task is added");
                scenario.Then("it should be stored in a list" , () =>
                {
                    var task = new Task();

                    iteration.AddTask(task);

                    var tasks = (List<Task>) iteration.Tasks;

                    tasks[0].ShouldBe(task);
                });
            });
        }
        private void SetupObjectGraph()
        {
            server = new ProjectInfoServer()
            {
                Name = "RallyDev",
                Url = "http://community.rally.com"
            };

            #region Project setup

            var project1 = new Project()
            {
                Name = TESTPROJECTNAME_ONE,
                SystemId = "project1",
            };
            server.AddProject(project1);

            var project2 = new Project()
            {
                Name = TESTPROJECTNAME_TWO,
                SystemId = "project2",
            };
            server.AddProject(project2);

            #endregion

            #region Iteration setup

            var iteration1 = new Iteration()
            {
                Name = TESTITERATIONNAME_ONE,
                SystemId = "iteration1",
            };
            project1.AddIteration(iteration1);

            var iteration2 = new Iteration()
            {
                Name = TESTITERATIONNAME_TWO,
                SystemId = "iteration2",
            };
            project2.AddIteration(iteration2);

            #endregion

            #region Task setup

            var task1 = new Task()
            {
                Name = TESTTASKNAME_ONE,
                SystemId = "task1",
                WorkEffortEstimate = 1
            };
            iteration1.AddTask(task1);

            var task2 = new Task()
            {
                Name = TESTTASKNAME_TWO,
                SystemId = "task2",
                WorkEffortEstimate = 2,
            };
            iteration2.AddTask(task2);

            #endregion

            #region WorkEffortHistoryItem setup

            var wehi_1_1 = new WorkEffortHistoryItem()
            {
                RemainingWorkEffort = 11,
                TimeStampForUpdate = new DateTime(2009, 01, 01)
            };
            task1.AddWorkEffortHistoryItem(wehi_1_1);

            var wehi_1_2 = new WorkEffortHistoryItem()
            {
                RemainingWorkEffort = 12,
                TimeStampForUpdate = new DateTime(2009, 01, 02)
            };
            task1.AddWorkEffortHistoryItem(wehi_1_2);

            var wehi_2_1 = new WorkEffortHistoryItem()
            {
                RemainingWorkEffort = 21,
                TimeStampForUpdate = new DateTime(2009, 02, 01)
            };
            task2.AddWorkEffortHistoryItem(wehi_2_1);

            var wehi_2_2 = new WorkEffortHistoryItem()
            {
                RemainingWorkEffort = 22,
                TimeStampForUpdate = new DateTime(2009, 02, 02)
            };
            task2.AddWorkEffortHistoryItem(wehi_2_2);

            #endregion
        }