예제 #1
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");
        }
예제 #2
0
        public void UpdateStatusTest()
        {
            Issue target = new Issue();
            target.UpdateStatus(Issue.IssueStatus.Unresolved, DateTime.Now);
            Assert.AreEqual(target.CurrentStatus, Issue.IssueStatus.Unresolved);

            target.UpdateStatus(Issue.IssueStatus.Resolved, DateTime.Now.AddMinutes(1));
            Assert.AreEqual(target.CurrentStatus, Issue.IssueStatus.Resolved);

            target.UpdateStatus(Issue.IssueStatus.Unresolved, DateTime.Now.Subtract(TimeSpan.FromDays(1)));
            Assert.AreEqual(target.CurrentStatus, Issue.IssueStatus.Resolved);

            target.UpdateStatus(Issue.IssueStatus.Unresolved, DateTime.Now.Add(TimeSpan.FromDays(1)));
            Assert.AreEqual(target.CurrentStatus, Issue.IssueStatus.Unresolved);
        }
예제 #3
0
        public void StatusOnTest()
        {
            Issue issue = new Issue();
            issue.EntryDate = DateTime.Now;
            DateTime statusTime = DateTime.Now;
            issue.UpdateStatus(Issue.IssueStatus.Unresolved, statusTime);

            Issue.IssueStatus status = issue.StatusOn(statusTime.AddDays(1));
            Assert.AreEqual(status, Issue.IssueStatus.Unresolved);

            issue.UpdateStatus(Issue.IssueStatus.Resolved, statusTime.AddDays(2));
            status = issue.StatusOn(statusTime.AddDays(3));
            Assert.AreEqual(status, Issue.IssueStatus.Resolved);

            issue = new Issue();
            issue.EntryDate = DateTime.Now;
            DateTime testBoundary = DateTime.Now.AddDays(10);
            issue.UpdateStatus(Issue.IssueStatus.Resolved, DateTime.Now);
            issue.UpdateStatus(Issue.IssueStatus.Unresolved, testBoundary);
            Assert.AreEqual(issue.StatusOn(DateTime.Now), Issue.IssueStatus.Resolved);
            Assert.AreEqual(issue.StatusOn(DateTime.Now.AddDays(5)), Issue.IssueStatus.Resolved);
            Assert.AreEqual(issue.StatusOn(testBoundary.Subtract(TimeSpan.FromMilliseconds(100))), Issue.IssueStatus.Resolved);
            Assert.AreEqual(issue.StatusOn(testBoundary), Issue.IssueStatus.Unresolved);
            Assert.AreEqual(issue.StatusOn(testBoundary.AddMilliseconds(100)), Issue.IssueStatus.Unresolved);
            Assert.AreEqual(issue.StatusOn(testBoundary.AddDays(1)), Issue.IssueStatus.Unresolved);
        }
예제 #4
0
 public void UpdateStatusBeforeCreatedTest()
 {
     Issue issue = new Issue();
     issue.EntryDate = DateTime.Now;
     issue.UpdateStatus(Issue.IssueStatus.Unresolved, DateTime.Now.Subtract(TimeSpan.FromDays(1)));
 }