public async Task Analyzed_as_valid_issue()
        {
            var stateFiltering = new StateFilteringParameter(new string[0], new string[0]);

            var issue = new CachedIssue()
            {
                Project       = DefaultProjectKey,
                Key           = DefaultProjectKey + "-1",
                Type          = "Story",
                StatusChanges = new Collection <CachedIssueStatusChange>()
            };

            _jiraCacheAdapter.Issues.Add(issue);
            var issues = await _tasksSource.GetAllIssues(DefaultProjectKey, stateFiltering);

            var analyzedIssue = Assert.Single(issues);

            var expectedIssue = new AnalyzedIssue()
            {
                Project                 = DefaultProjectKey,
                Key                     = DefaultProjectKey + "-1",
                Type                    = "Story",
                StatusChanges           = issue.StatusChanges,
                SimplifiedStatusChanges = new Collection <CachedIssueStatusChange>()
            };

            _compareLogic.AssertEqual <object>(expectedIssue, analyzedIssue);
        }
        public async Task Non_started_issue_is_analyzed()
        {
            var stateFiltering = new StateFilteringParameter(new [] { "B" }, new string[0]);

            var issue = new CachedIssue()
            {
                Project       = DefaultProjectKey,
                Key           = DefaultProjectKey + "-1",
                StatusChanges = new Collection <CachedIssueStatusChange>()
                {
                    new CachedIssueStatusChange(new DateTime(2012, 1, 1), "A"),
                }
            };

            _jiraCacheAdapter.Issues.Add(issue);
            var issues = await _tasksSource.GetAllIssues(DefaultProjectKey, stateFiltering);

            var analyzedIssue = Assert.Single(issues);

            var expectedIssue = new AnalyzedIssue()
            {
                Project                 = DefaultProjectKey,
                Key                     = DefaultProjectKey + "-1",
                StatusChanges           = issue.StatusChanges,
                SimplifiedStatusChanges = new Collection <CachedIssueStatusChange>(),
                Started                 = null,
                Ended                   = null,
                Duration                = null
            };

            _compareLogic.AssertEqual <object>(expectedIssue, analyzedIssue);
        }
Exemple #3
0
        public static bool IsValidIssue(AnalyzedIssue issue)
        {
            // TODO : Automated tests and ability to change for user

            return
                ((issue.Type == "Story" || issue.Type == "Bug") &&
                 (issue.Resolution != "Cancelled" && issue.Resolution != "Duplicate") &&
                 (issue.Status != "Withdrawn" && issue.Status != "On Hold"));
        }
Exemple #4
0
        private static FinishedIssue MapToFinishedIssue(AnalyzedIssue issue)
        {
            var flowIssue = new FinishedIssue()
            {
                Project       = issue.Project,
                Key           = issue.Key,
                Title         = issue.Title,
                Type          = issue.Type,
                Started       = issue.Started.Value,
                Ended         = issue.Ended.Value,
                Duration      = issue.Duration.Value,
                StoryPoints   = issue.StoryPoints,
                StatusChanges = issue.SimplifiedStatusChanges
            };

            return(flowIssue);
        }
        public async Task Analyzed_issue_contains_simplified_states()
        {
            var stateFiltering = new StateFilteringParameter(new [] { "A", "C" }, new [] { "D" });

            var issue = new CachedIssue()
            {
                Project       = DefaultProjectKey,
                Key           = DefaultProjectKey + "-1",
                StatusChanges = new Collection <CachedIssueStatusChange>()
                {
                    new CachedIssueStatusChange(new DateTime(2012, 1, 1), "A"),
                    new CachedIssueStatusChange(new DateTime(2012, 1, 2), "D"),

                    new CachedIssueStatusChange(new DateTime(2012, 2, 1), "A"),
                    new CachedIssueStatusChange(new DateTime(2012, 2, 2), "B"),
                    new CachedIssueStatusChange(new DateTime(2012, 2, 3), "C"),
                }
            };

            _jiraCacheAdapter.Issues.Add(issue);
            var issues = await _tasksSource.GetAllIssues(DefaultProjectKey, stateFiltering);

            var analyzedIssue = Assert.Single(issues);

            var expectedIssue = new AnalyzedIssue
            {
                Project                 = DefaultProjectKey,
                Key                     = DefaultProjectKey + "-1",
                StatusChanges           = issue.StatusChanges,
                SimplifiedStatusChanges = new Collection <CachedIssueStatusChange>()
                {
                    new CachedIssueStatusChange(new DateTime(2012, 2, 1), "A"),
                    new CachedIssueStatusChange(new DateTime(2012, 2, 3), "C"),
                },
                Started  = new DateTime(2012, 2, 1),
                Ended    = new DateTime(2012, 2, 3),
                Duration = TimeSpan.FromDays(2)
            };

            _compareLogic.AssertEqual <object>(expectedIssue, analyzedIssue);
        }