Esempio n. 1
0
        public async Task CreatedProjectLabelCanBeUpdated()
        {
            //arrange
            var createdLabel = await _sut.CreateLabelAsync(GitLabApiHelper.TestProjectTextId, new CreateProjectLabelRequest("Label 1")
            {
                Color       = "#FFFFFF",
                Description = "description1",
                Priority    = 1
            });

            //act
            var updateRequest = UpdateProjectLabelRequest.FromNewName(createdLabel.Name, "Label 11");

            updateRequest.Color       = "#000000";
            updateRequest.Description = "description11";
            updateRequest.Priority    = 11;

            var updatedLabel = await _sut.UpdateLabelAsync(GitLabApiHelper.TestProjectTextId, updateRequest);

            await _sut.DeleteLabelAsync(GitLabApiHelper.TestProjectId, updatedLabel.Name);

            //assert
            updatedLabel.Should().Match <Label>(l =>
                                                l.Name == "Label 11" &&
                                                l.Color == "#000000" &&
                                                l.Description == "description11" &&
                                                l.Priority == 11);
        }
Esempio n. 2
0
        public async Task UpdateLabelAsync(Label oldLabel, Label newLabel)
        {
            var request = UpdateProjectLabelRequest.FromNewName(oldLabel.Name, newLabel.Name);

            request.Color       = newLabel.Color;
            request.Description = newLabel.Description;
            request.Priority    = newLabel.Priority;
            await client.Projects.UpdateLabelAsync(projectId, request);
        }
Esempio n. 3
0
 /// <summary>
 /// Updates an existing label with new name or new color. At least one parameter is required, to update the label.
 /// </summary>
 /// <param name="projectId">The ID, path or <see cref="Project"/> of the project.</param>
 /// <param name="request">Update label request.</param>
 /// <returns>Newly modified label.</returns>
 public async Task <Label> UpdateLabelAsync(ProjectId projectId, UpdateProjectLabelRequest request)
 {
     Guard.NotNull(request, nameof(request));
     return(await _httpFacade.Put <Label>($"projects/{projectId}/labels", request));
 }