Ejemplo n.º 1
0
        private static IEnumerable<Issue> GetAllRelatedIssuesUpwards(Issue issue, IReadOnlyList<Issue> all)
        {
            var result = new List<Issue>();

            foreach (var id in issue.LinksTo)
            {
                var parent = all.Single(x => x.Id == id);

                result.Add(parent);

                foreach (var ancestor in GetAllRelatedIssuesUpwards(parent, all))
                {
                    result.Add(ancestor);
                }
            }

            return result;
        }
Ejemplo n.º 2
0
 private static IEnumerable<Issue> GetAllRelatedIssues(Issue issue, IReadOnlyList<Issue> all)
 {
     return GetAllRelatedIssuesUpwards(issue, all)
         .Union(GetAllRelatedIssuesDownwards(issue, all))
         .Union(new[] { issue });
 }
Ejemplo n.º 3
0
        private static IEnumerable<Issue> GetAllRelatedIssuesDownwards(Issue issue, IReadOnlyList<Issue> all)
        {
            var children = all.Where(x => x.LinksTo.Contains(issue.Id));

            foreach (var child in children)
            {
                yield return child;

                foreach (var descendant in GetAllRelatedIssuesDownwards(child, all))
                {
                    yield return descendant;
                }
            }
        }