Пример #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);
        }
Пример #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);
        }