Ejemplo n.º 1
0
        /// <summary>
        /// method to export board rows (kanban board) from source project
        /// </summary>
        /// <param name="project"></param>
        /// <returns></returns>
        public GetBoardRowsResponse.Result GetBoardRows(string project)
        {
            GetBoardRowsResponse.Result viewModel = new GetBoardRowsResponse.Result();
            try
            {
                using (var client = new HttpClient())
                {
                    client.BaseAddress = new Uri(_sourceConfig.UriString);
                    client.DefaultRequestHeaders.Accept.Clear();
                    client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", _sourceCredentials);

                    HttpResponseMessage response = client.GetAsync(_sourceConfig.UriString + string.Format("/DefaultCollection/{0}/{1}%20Team/_apis/work/boards/Backlog%20items/Rows?api-version=2.0", project, project)).Result;
                    if (response.IsSuccessStatusCode)
                    {
                        viewModel = response.Content.ReadAsAsync <GetBoardRowsResponse.Result>().Result;
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error occured while generating board row template: " + ex.Message);
                Console.WriteLine("");
            }
            return(viewModel);
        }
Ejemplo n.º 2
0
        public void UpdateWorkItem()
        {
            WorkItemFetchResponse.WorkItems fetchedEpics           = getWorkItemsfromSource("Epic");
            WorkItemFetchResponse.WorkItems fetchedFeatures        = getWorkItemsfromSource("Feature");
            WorkItemFetchResponse.WorkItems fetchedPBIs            = getWorkItemsfromSource("Product Backlog Item");
            WorkItemFetchResponse.WorkItems fetchedTasks           = getWorkItemsfromSource("Task");
            WorkItemFetchResponse.WorkItems fetchedTestCase        = getWorkItemsfromSource("Test Case");
            WorkItemFetchResponse.WorkItems fetchedBugs            = getWorkItemsfromSource("Bug");
            WorkItemFetchResponse.WorkItems fetchedUserStories     = getWorkItemsfromSource("User Story");
            WorkItemFetchResponse.WorkItems fetchedTestSuits       = getWorkItemsfromSource("Test Suite");
            WorkItemFetchResponse.WorkItems fetchedTestPlan        = getWorkItemsfromSource("Test Plan");
            WorkItemFetchResponse.WorkItems fetchedFeedbackRequest = getWorkItemsfromSource("Feedback Request");



            GetBoardRowsResponse.Result fetchedBoardRows = GetBoardRows(_sourceConfig.Project);

            if (!Directory.Exists("Templates"))
            {
                Directory.CreateDirectory("Templates");
            }

            string fetchedPBIsJSON = JsonConvert.SerializeObject(fetchedPBIs, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\PBIfromTemplate.json", fetchedPBIsJSON);
            string fetchedTasksJSON = JsonConvert.SerializeObject(fetchedTasks, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\TaskfromTemplate.json", fetchedTasksJSON);
            string fetchedTestCasesJSON = JsonConvert.SerializeObject(fetchedTestCase, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\TestCasefromTemplate.json", fetchedTestCasesJSON);
            string fetchedBugsJSON = JsonConvert.SerializeObject(fetchedBugs, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\BugfromTemplate.json", fetchedBugsJSON);
            string fetchedEpicsJSON = JsonConvert.SerializeObject(fetchedEpics, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\EpicfromTemplate.json", fetchedEpicsJSON);
            string fetchedFeaturesJSON = JsonConvert.SerializeObject(fetchedFeatures, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\FeaturefromTemplate.json", fetchedFeaturesJSON);
            string fetchedUerStoriesJSON = JsonConvert.SerializeObject(fetchedUserStories, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\UerStoriesfromTemplate.json", fetchedUerStoriesJSON);
            string fetchedTestSuitsJSON = JsonConvert.SerializeObject(fetchedTestSuits, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\TestSuitesFromTemplate.json", fetchedTestSuitsJSON);
            string fetchedTestPlanJSON = JsonConvert.SerializeObject(fetchedTestPlan, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\TestPlanFromTemplate.json", fetchedTestPlanJSON);
            string fetchedFeedbackRequestJSON = JsonConvert.SerializeObject(fetchedFeedbackRequest, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\FeedbackRequestFromTemplate.json", fetchedFeedbackRequestJSON);


            string fetchedBoardRowsJSON = JsonConvert.SerializeObject(fetchedBoardRows.value, Formatting.Indented);

            System.IO.File.WriteAllText(@"Templates\BoardRowsFromTemplate.json", fetchedBoardRowsJSON);
        }