public void SummaryForProjectTest()
        {
            IssuePriorityReport target = new IssuePriorityReport(); // TODO: Initialize to an appropriate value
            Project project = new Project(1, "Test", DateTime.Now, DateTime.Now.AddDays(1), "", "", "", DateTime.Now.AddDays(1));

            TableRow[] result = target.SummaryForProject(null);
            Assert.AreEqual(result.Length, 0);

            result = target.SummaryForProject(project);
            Assert.AreEqual(result.Length, 5);
            Assert.AreEqual("Issues by Priority", result[0].Cells[0].Text);
            Assert.AreEqual("Priority", result[1].Cells[0].Text);
            Assert.AreEqual("Count", result[1].Cells[1].Text);
            Assert.AreEqual("High", result[2].Cells[0].Text);
            Assert.AreEqual("Medium", result[3].Cells[0].Text);
            Assert.AreEqual("Low", result[4].Cells[0].Text);
            Assert.AreEqual("0", result[2].Cells[1].Text);
            Assert.AreEqual("0", result[3].Cells[1].Text);
            Assert.AreEqual("0", result[4].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.High));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[2].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.Medium));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[3].Cells[1].Text);

            project.AddIssue(CreateIssue(Issue.IssuePriority.Low));
            result = target.SummaryForProject(project);
            Assert.AreEqual("1", result[4].Cells[1].Text);
        }
示例#2
0
        public void SummaryForProjectTest()
        {
            IssueStatus target = new IssueStatus();
            Project project = null;
            TableRow[] actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 0);

            project = new Project(1, "Test", DateTime.Now.Subtract(TimeSpan.FromDays(5)), DateTime.Now, "Status", "Description", "Category", DateTime.Now);
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 4);
            Assert.AreEqual(actual[2].Cells[1].Text, "0");
            Assert.AreEqual(actual[3].Cells[1].Text, "0");

            project.AddIssue(new Issue());
            Issue issue = new Issue();
            issue.UpdateStatus(Issue.IssueStatus.Resolved, DateTime.Now);
            project.AddIssue(issue);
            actual = target.SummaryForProject(project);
            Assert.AreEqual(actual.Length, 4);
            Assert.AreEqual(actual[2].Cells[1].Text, "1");
            Assert.AreEqual(actual[3].Cells[1].Text, "1");
        }
 private static void AddIssuePriorityCount(Project project, int count, Issue.IssuePriority priority)
 {
     for (int i = 0; i < count; i++)
     {
         Issue issue = new Issue();
         issue.CurrentPriority = priority;
         project.AddIssue(issue);
     }
 }
 private Project CreateInitialProject()
 {
     Project project = new Project(1, "Test", DateTime.Now.Subtract(TimeSpan.FromDays(5)), DateTime.Now, "Status", "Description", "Category", DateTime.Now);
     Issue issue = new Issue();
     issue.Assignee = new User(0, "User1", "", "", "", "", "", "", "", "");
     project.AddIssue(issue);
     return project;
 }