예제 #1
0
        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));
            }
        }
 public void GetNameTest()
 {
     Assert.AreEqual("Chengkan Huang", MembershipCheckHelpers.GetName(User0));
     Assert.AreEqual("Sriram Dhanasekaran", MembershipCheckHelpers.GetName(User1));
 }