public void CreateDeleteNewsComment() { TroubleshooterCommentRequest troubleshooterCommentRequest = new TroubleshooterCommentRequest { TroubleshooterStepId = 1, Contents = "Contents", CreatorType = TroubleshooterCommentCreatorType.Staff, Email = "", CreatorId = 1 }; var troubleshooterComment = TestSetup.KayakoApiService.Troubleshooter.CreateTroubleshooterComment(troubleshooterCommentRequest); Assert.IsNotNull(troubleshooterComment); Assert.That(troubleshooterComment.TroubleshooterStepId, Is.EqualTo(troubleshooterCommentRequest.TroubleshooterStepId)); Assert.That(troubleshooterComment.Contents, Is.EqualTo(troubleshooterCommentRequest.Contents)); Assert.That(troubleshooterComment.CreatorType, Is.EqualTo(troubleshooterCommentRequest.CreatorType)); Assert.That(troubleshooterComment.Email, Is.EqualTo(troubleshooterCommentRequest.Email)); Assert.That(troubleshooterComment.CreatorId, Is.EqualTo(troubleshooterCommentRequest.CreatorId)); var deleteResult = TestSetup.KayakoApiService.Troubleshooter.DeleteTroubleshooterComment(troubleshooterComment.Id); Assert.IsTrue(deleteResult); }
public void CreateTroubleshooterComment() { var troubleshooterCommentRequest = new TroubleshooterCommentRequest { TroubleshooterStepId = 1, Contents = "Contents", CreatorType = TroubleshooterCommentCreatorType.User, CreatorId = 1, FullName = "FullName", Email = "*****@*****.**", ParentCommentId = 3 }; const string apiMethod = "/Troubleshooter/Comment"; const string parameters = "troubleshooterstepid=1&contents=Contents&creatortype=2&creatorid=1&fullname=FullName&[email protected]&parentcommentid=3"; _kayakoApiRequest.Setup(x => x.ExecutePost<TroubleshooterCommentCollection>(apiMethod, parameters)).Returns(_responseTroubleshooterCommentCollection); var troubleshooterComment = _troubleshooterController.CreateTroubleshooterComment(troubleshooterCommentRequest); _kayakoApiRequest.Verify(x => x.ExecutePost<TroubleshooterCommentCollection>(apiMethod, parameters), Times.Once()); Assert.That(troubleshooterComment, Is.EqualTo(_responseTroubleshooterCommentCollection.FirstOrDefault())); }
private RequestBodyBuilder PopulateRequestParameters(TroubleshooterCommentRequest troubleshooterCommentRequest, RequestTypes requestType) { troubleshooterCommentRequest.EnsureValidData(requestType); RequestBodyBuilder parameters = new RequestBodyBuilder(); parameters.AppendRequestDataNonNegativeInt("troubleshooterstepid", troubleshooterCommentRequest.TroubleshooterStepId); parameters.AppendRequestDataNonEmptyString("contents", troubleshooterCommentRequest.Contents); parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(troubleshooterCommentRequest.CreatorType)); parameters.AppendRequestDataNonNegativeInt("creatorid", troubleshooterCommentRequest.CreatorId); parameters.AppendRequestDataNonEmptyString("fullname", troubleshooterCommentRequest.FullName); parameters.AppendRequestDataNonEmptyString("email", troubleshooterCommentRequest.Email); parameters.AppendRequestDataNonNegativeInt("parentcommentid", troubleshooterCommentRequest.ParentCommentId); return parameters; }
public TroubleshooterComment CreateTroubleshooterComment(TroubleshooterCommentRequest troubleshooterCommentRequest) { RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterCommentRequest, RequestTypes.Create); TroubleshooterCommentCollection troubleshooterComments = Connector.ExecutePost<TroubleshooterCommentCollection>(TroubleshooterCommentBaseUrl, parameters.ToString()); if (troubleshooterComments != null && troubleshooterComments.Count > 0) { return troubleshooterComments[0]; } return null; }
public static TroubleshooterComment ToResponseData(TroubleshooterCommentRequest requestData) { return(ToResponseType <TroubleshooterCommentRequest, TroubleshooterComment>(requestData)); }
public static TroubleshooterComment ToResponseData(TroubleshooterCommentRequest requestData) { return ToResponseType<TroubleshooterCommentRequest, TroubleshooterComment>(requestData); }