Esempio n. 1
0
        // branch Utils API
        public async Task<Branch> Create(string projectKey, string repositorySlug, Branch branch)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(MANAGE_BRANCHES, null, projectKey, repositorySlug);

            Branch response = await _httpWorker.PostAsync(requestUrl, branch);

            return response;
        }
Esempio n. 2
0
        public async Task Delete(string projectKey, string repositorySlug, Branch branch)
        {
            string requestUrl = UrlBuilder.FormatRestApiUrl(MANAGE_BRANCHES, null, projectKey, repositorySlug);

            await _httpWorker.DeleteWithRequestContentAsync(requestUrl, branch);
        }
Esempio n. 3
0
        public async Task Can_CreateBranch_Than_DeleteBranch()
        {
            Branch newBranch = new Branch { Name = "test-repo", StartPoint = EXISTING_BRANCH_REFERENCE };
            var createdBranch = await stashClient.Branches.Create(EXISTING_PROJECT, EXISTING_REPOSITORY, newBranch);

            Assert.IsNotNull(createdBranch);
            Assert.IsInstanceOfType(createdBranch, typeof(Branch));
            Assert.AreEqual(newBranch.Name.ToLower(), createdBranch.DisplayId.ToLower());


            Branch deleteBranch = new Branch { Name = newBranch.Name, DryRun = false };

            await stashClient.Branches.Delete(EXISTING_PROJECT, EXISTING_REPOSITORY, deleteBranch);
        }