Esempio n. 1
0
        public void ShouldGetDoneDateForInProgressDateWithNoInProgressStateMaps()
        {
            var jiraStates = new List <JiraState>()
            {
                new JiraState(new DateTime(2020, 10, 7), "TO_DO", "DOING"),
                new JiraState(new DateTime(2020, 10, 8), "DOING", "VALIDATING"),
                new JiraState(new DateTime(2020, 10, 9), "VALIDATING", "DONE")
            };

            var partialWorkflowMap = new List <WorkflowMap>()
            {
                new WorkflowMap(new string[] { "TO_DO" }, "STUFF TO DO", StateType.ToDo, "TEST_TYPE", 1),
                new WorkflowMap(new string[] { "DONE" }, "FINISHED", StateType.Done, "TEST_TYPE", 4)
            };

            var testIssue = new JiraIssue("TEST_KEY", "DESCRIPTION")
            {
                JiraStates = jiraStates,
                Type       = "TEST_TYPE",
                Status     = "DONE"
            };

            var target = IssueTimeInStateMapper.GetInProgressDate(testIssue, partialWorkflowMap);

            Assert.AreEqual(new DateTime(2020, 10, 9), target);
        }
Esempio n. 2
0
        public void ShouldNotGetValidInProgressDateWhenNotStarted()
        {
            var jiraStates = new List <JiraState>()
            {
                new JiraState(new DateTime(2020, 10, 7), "", "TO_DO")
            };

            var testIssue = new JiraIssue("TEST_KEY", "DESCRIPTION")
            {
                JiraStates = jiraStates,
                Type       = "TEST_TYPE",
                Status     = "TO_DO"
            };

            var target = IssueTimeInStateMapper.GetInProgressDate(testIssue, _mockWorkflowMap);

            Assert.AreEqual(DateTime.MinValue, target);
        }
Esempio n. 3
0
        public void ShouldGetDoneDateForInProgressDateWhenOnlyMovedToDone()
        {
            var jiraStates = new List <JiraState>()
            {
                new JiraState(new DateTime(2020, 10, 7), "", "TO_DO"),
                new JiraState(new DateTime(2020, 10, 8), "TO_DO", "DONE")
            };

            var testIssue = new JiraIssue("TEST_KEY", "DESCRIPTION")
            {
                JiraStates = jiraStates,
                Type       = "TEST_TYPE",
                Status     = "DONE"
            };

            var target = IssueTimeInStateMapper.GetInProgressDate(testIssue, _mockWorkflowMap);

            Assert.AreEqual(new DateTime(2020, 10, 8), target);
        }
Esempio n. 4
0
        public void ShouldGetEarliestInProgressStatusForInProgressDate()
        {
            var jiraStates = new List <JiraState>()
            {
                new JiraState(new DateTime(2020, 10, 7), "TO_DO", "DOING"),
                new JiraState(new DateTime(2020, 10, 8), "DOING", "VALIDATING"),
                new JiraState(new DateTime(2020, 10, 9), "VALIDATING", "DOING"),
                new JiraState(new DateTime(2020, 10, 10), "DOING", "VALIDATING"),
                new JiraState(new DateTime(2020, 10, 11), "VALIDATING", "DONE")
            };

            var testIssue = new JiraIssue("TEST_KEY", "DESCRIPTION")
            {
                JiraStates = jiraStates,
                Type       = "TEST_TYPE",
                Status     = "DONE"
            };

            var target = IssueTimeInStateMapper.GetInProgressDate(testIssue, _mockWorkflowMap);

            Assert.AreEqual(new DateTime(2020, 10, 7), target);
        }