コード例 #1
0
 public void GenerateReivewNameTest()
 {
     Assert.AreEqual("CreateSPT-RequestId-15", SystemHelpers.GenerateReivewName(_request));
 }
コード例 #2
0
ファイル: Worker.cs プロジェクト: chuang85/Onboarding
        private static void HandleCreated(OnboardingRequest request)
        {
            if (request.Type == RequestType.CreateSPT || request.Type == RequestType.UpdateSPT)
            {
                SystemHelpers.SaveXmlToDisk(request);
                SystemHelpers.AddFileToDepotAndPack(SystemHelpers.GenerateFilename(request));

                // Create a code review.
                var codeFlowId = CodeFlowHelpers.CreateReview(_rClient, request.CreatedBy,
                                                              MembershipCheckHelpers.GetName(request.CreatedBy),
                                                              MembershipCheckHelpers.GetEmailAddress(request.CreatedBy), SystemHelpers.GenerateReivewName(request),
                                                              Constants.ProjectShortName);
                // Assign ReviewId to the corresponding field in OnboardingRequest
                request.CodeFlowId = codeFlowId;
                // Create a code package and add it to the review
                CodeFlowHelpers.AddCodePackage(_rClient, request.CodeFlowId,
                                               CodeFlowHelpers.CreateCodePackage("testing pack", request.CreatedBy, request.CreatedBy,
                                                                                 CodePackageFormat.SourceDepotPack,
                                                                                 new Uri(Constants.DepotPath + SystemHelpers.GenerateFilename(request) + ".dpk")));
                // Add reviewers to the review
                CodeFlowHelpers.AddReviewers(_rClient, request.CodeFlowId, new Reviewer[]
                {
                    CodeFlowHelpers.CreateReviewer(request.CreatedBy, MembershipCheckHelpers.GetName(request.CreatedBy),
                                                   MembershipCheckHelpers.GetEmailAddress(request.CreatedBy), true)
                });
                // Publish the review
                CodeFlowHelpers.PublishReview(_rClient, request.CodeFlowId, "meesage from author");
                Logger.Info("Code review with id [" + request.CodeFlowId + "] has been published");
                // Change State from "Created" to "PendingReview"
                request.State = RequestState.PendingReview;
                Logger.Info("Change the state of request with id [" + request.RequestId + "] to [PendingReview]");
                // Revert file to clean the changelist
                SystemHelpers.RevertFile(SystemHelpers.GenerateFilename(request));
            }
        }