public JsonPatchDocument Create(string twitchUsername, DevOpsBug bugInfo)
        {
            var jsonPatchDocument = _createJsonPatchForWorkItemCommand.Create(twitchUsername, bugInfo);

            jsonPatchDocument
            .AddReproSteps(bugInfo.ReproSteps)
            .AddSystemInfo(bugInfo.SystemInfo);

            return(jsonPatchDocument);
        }
        public async Task <bool> RaiseBugInBacklog(string twitchUsername, DevOpsBug bugInfo)
        {
            try
            {
                var jsonPatch = _createJsonPatchDocumentFromBugRequestCommand.Create(twitchUsername, bugInfo);

                await _workItemTrackingClient.CreateWorkItemAsync(jsonPatch, _configService.Get <string>("DevOpsProjectName"), "Bug");

                return(true);
            }
            catch (Exception e)
            {
                _logger.LogError(e,
                                 $"Could not raise bug: {twitchUsername}, {bugInfo.Title}, {bugInfo.ReproSteps}, {bugInfo.AcceptanceCriteria}, {bugInfo.SystemInfo}");
                return(false);
            }
        }
Esempio n. 3
0
        public void EnsureJsonPatchIsGenerated(string twitchUsername, string title, string state, string assignedTo,
                                               string acceptanceCriteria, string reproSteps, string systemInfo)
        {
            var bug = new DevOpsBug
            {
                Title              = title,
                State              = state,
                AssignedTo         = assignedTo,
                AcceptanceCriteria = acceptanceCriteria,
                ReproSteps         = reproSteps,
                SystemInfo         = systemInfo
            };

            var jsonPatch = _subject.Create(twitchUsername, bug);

            Assert.IsTrue(string.Equals(
                              (string)jsonPatch.SingleOrDefault(j => j.Path == $"/fields/{AzureDevOpsFields.ReproSteps}")
                              ?.Value, bug.ReproSteps, StringComparison.InvariantCulture));
            Assert.IsTrue(string.Equals(
                              (string)jsonPatch.SingleOrDefault(j => j.Path == $"/fields/{AzureDevOpsFields.SystemInfo}")
                              ?.Value, bug.SystemInfo, StringComparison.InvariantCulture));
        }
Esempio n. 4
0
        public async Task <bool> Raise(string twitchUsername, DevOpsBug bugInfo)
        {
            var result = await _azureDevOpsService.RaiseBugInBacklog(twitchUsername, bugInfo);

            return(result);
        }