Example #1
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 Finished_issue_is_analyzed()
        {
            var stateFiltering = new StateFilteringParameter(new [] { "A", "C" }, new string[0]);

            var issue = new CachedIssue()
            {
                Project       = DefaultProjectKey,
                Key           = DefaultProjectKey + "-1",
                Title         = "Title",
                Type          = "Story",
                StoryPoints   = 12,
                StatusChanges = new Collection <CachedIssueStatusChange>()
                {
                    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.GetLatestFinishedStories(DefaultProjectKey, new IssuesFromParameters(new DateTime(2012, 1, 1)), stateFiltering);

            var analyzedIssue = Assert.Single(issues);

            var expectedIssue = new FinishedIssue()
            {
                Project       = DefaultProjectKey,
                Key           = DefaultProjectKey + "-1",
                Title         = issue.Title,
                Type          = issue.Type,
                StoryPoints   = issue.StoryPoints,
                StatusChanges = 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(expectedIssue, analyzedIssue);
        }