/// <summary> /// The internal Assembler converting the <see cref="SearchIssuesResponse"/> to an enriched list of Sonar Issues. /// </summary> /// <param name="searchIssuesResponse">The list of Issues from the Sonar API.</param> /// <param name="groupADSet">The active directory information needed to get some informations.</param> /// <param name="mapper">The AutoMapper interface to create the Issues Detail <see cref="IssueDetail"/>.</param> /// <param name="sonarConnector">The link to the Sonar Services.</param> /// <returns>An enriched and filtered list of Sonar Issues.</returns> internal static List <Issue> CreateIssueSet(this SearchIssuesResponse searchIssuesResponse, GroupADSet groupADSet, IMapper mapper, ISonarConnector sonarConnector, ITfsConnector tfsConnector) { List <Issue> issueSet = new List <Issue>(); if (searchIssuesResponse?.issues == null) { return(issueSet); } issueSet.Capacity = searchIssuesResponse.issues.Count; foreach (var responseIssue in searchIssuesResponse.issues) { if (responseIssue != null) { Issue issue = new Issue() { IssueDetail = mapper.Map <IssueDetail>(responseIssue) }; issue = issue.AddChangeSet(sonarConnector); if (issue.ChangeSetDate != null && issue.ChangeSetDate?.AddDays(5) > issue.IssueDetail.creationDate) { issue = issue.AddCodeProject(tfsConnector); issue = issue.AddActiveDirectoryGroup(groupADSet); issue = issue.AddCodeLineCount(tfsConnector); issueSet.Add(issue); } } } issueSet.TrimExcess(); return(issueSet); }