public static string GetCard(AzureDevOpsWorkItem workItem)
        {
            var filePath = $"Cards\\{typeof(BugCard).Name}.mustache";
            var fileContentsWithMustachePlaceholders = File.ReadAllText(filePath);
            var compiler      = new FormatCompiler();
            var generator     = compiler.Compile(fileContentsWithMustachePlaceholders);
            var processedCard = generator.Render(BugViewModel.CreateFrom(workItem));

            return(processedCard);
        }
Esempio n. 2
0
        public static BugViewModel CreateFrom(AzureDevOpsWorkItem workItem)
        {
            var result = new BugViewModel()
            {
                Id       = workItem.Id,
                Title    = workItem.Fields.Title,
                Priority = workItem.Fields.Priority,
                State    = workItem.Fields.State,
                Severity = workItem.Fields.Severity,
                BugLink  = workItem.Links.Html.Href
            };

            if (workItem.Fields.AssignedTo != null)
            {
                result.AssignedTo = new BuggablePerson()
                {
                    DisplayName = workItem.Fields.AssignedTo.DisplayName,
                    TeamsUserId = workItem.Fields.AssignedTo.TeamsUserId
                };
            }

            if (workItem.Fields.EMOwner != null)
            {
                result.EMOwner = new BuggablePerson()
                {
                    DisplayName = workItem.Fields.EMOwner.DisplayName,
                    TeamsUserId = workItem.Fields.EMOwner.TeamsUserId
                };
            }

            if (workItem.Fields.PMOwner != null)
            {
                result.PMOwner = new BuggablePerson()
                {
                    DisplayName = workItem.Fields.PMOwner.DisplayName,
                    TeamsUserId = workItem.Fields.PMOwner.TeamsUserId
                };
            }

            return(result);
        }