public static int CalculateLeanKitPriority(Jira.Issue issue) { //LK Priority: 0 = Low, 1 = Normal, 2 = High, 3 = Critical //Jira Priority: Blocker/Critical, Major, Minor, Trivial //JIRA Priority: Highest, High, Medium, Low, Lowest const int lkPriority = 1; // default to 1 - Normal if (issue == null || issue.Fields == null || issue.Fields.Priority == null || string.IsNullOrEmpty(issue.Fields.Priority.Name)) return lkPriority; switch (issue.Fields.Priority.Name) { case "Blocker": case "Critical": case "Highest": return 3; case "Major": case "High": return 2; case "Trivial": case "Low": case "Lowest": return 0; // case "Minor": default: return 1; } }
public static long? CalculateLeanKitAssignedUserId(long boardId, Jira.Issue issue, ILeanKitApi leanKit) { if (issue == null || issue.Fields == null || issue.Fields.Assignee == null || ( string.IsNullOrEmpty(issue.Fields.Assignee.Name) && string.IsNullOrEmpty(issue.Fields.Assignee.EmailAddress) && string.IsNullOrEmpty(issue.Fields.Assignee.DisplayName))) return null; var lkUser = leanKit.GetBoard(boardId).BoardUsers.FirstOrDefault(x => x != null && (((!string.IsNullOrEmpty(x.EmailAddress)) && (!string.IsNullOrEmpty(issue.Fields.Assignee.EmailAddress)) && x.EmailAddress.ToLowerInvariant() == issue.Fields.Assignee.EmailAddress.ToLowerInvariant()) || ((!string.IsNullOrEmpty(x.FullName)) && (!string.IsNullOrEmpty(issue.Fields.Assignee.Name)) && x.FullName.ToLowerInvariant() == issue.Fields.Assignee.Name.ToLowerInvariant()) || ((!string.IsNullOrEmpty(x.UserName)) && (!string.IsNullOrEmpty(issue.Fields.Assignee.Name)) && x.UserName.ToLowerInvariant() == issue.Fields.Assignee.Name.ToLowerInvariant()) || ((!string.IsNullOrEmpty(x.FullName)) && (!string.IsNullOrEmpty(issue.Fields.Assignee.DisplayName)) && x.FullName.ToLowerInvariant() == issue.Fields.Assignee.DisplayName.ToLowerInvariant()))); if (lkUser != null) return lkUser.Id; return null; }
protected override void OnStartTest() { TestItem = new Jira(SubscriptionManager, ConfigurationProvider, LocalStorage, LeanKitClientFactory, RestClient, JiraConnection); }