public void CreateDeleteKnowledgebaseComment()
        {
            var knowledgebaseArticles = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticles();

            Assert.IsNotNull(knowledgebaseArticles);
            Assert.IsNotEmpty(knowledgebaseArticles);

            var knowledgebaseCommentRequest = new KnowledgebaseCommentRequest
                {
                    KnowledgebaseArticleId = knowledgebaseArticles.FirstOrDefault().Id,
                    Contents = "contents",
                    Email = "*****@*****.**",
                    CreatorType = KnowledgebaseCommentCreatorType.User,
                    FullName = "Fullname"
                };

            var knowledgebaseComment = TestSetup.KayakoApiService.Knowledgebase.CreateKnowledgebaseComment(knowledgebaseCommentRequest);

            Assert.IsNotNull(knowledgebaseComment);
            Assert.That(knowledgebaseComment.KnowledgebaseArticleId, Is.EqualTo(knowledgebaseCommentRequest.KnowledgebaseArticleId));
            Assert.That(knowledgebaseComment.Contents, Is.EqualTo(knowledgebaseCommentRequest.Contents));
            Assert.That(knowledgebaseComment.Email, Is.EqualTo(knowledgebaseCommentRequest.Email));
            Assert.That(knowledgebaseComment.CreatorType, Is.EqualTo(knowledgebaseCommentRequest.CreatorType));
            Assert.That(knowledgebaseComment.FullName, Is.EqualTo(knowledgebaseCommentRequest.FullName));

            var deleteSuccess = TestSetup.KayakoApiService.Knowledgebase.DeleteKnowledgebaseComment(knowledgebaseComment.Id);

            Assert.IsTrue(deleteSuccess);
        }
		public static KnowledgebaseComment ToResponseData(KnowledgebaseCommentRequest requestData)
		{
			return ToResponseType<KnowledgebaseCommentRequest, KnowledgebaseComment>(requestData);
		}
 public static KnowledgebaseComment ToResponseData(KnowledgebaseCommentRequest requestData)
 {
     return(ToResponseType <KnowledgebaseCommentRequest, KnowledgebaseComment>(requestData));
 }
		private RequestBodyBuilder PopulateRequestParameters(KnowledgebaseCommentRequest knowledgebaseCommentRequest, RequestTypes requestType)
		{
			knowledgebaseCommentRequest.EnsureValidData(requestType);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestDataNonNegativeInt("knowledgebasearticleid", knowledgebaseCommentRequest.KnowledgebaseArticleId);
			parameters.AppendRequestDataNonEmptyString("contents", knowledgebaseCommentRequest.Contents);
			parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(knowledgebaseCommentRequest.CreatorType));
			
			if (knowledgebaseCommentRequest.CreatorId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("creatorid", knowledgebaseCommentRequest.CreatorId.Value);
			}
			else
			{
				parameters.AppendRequestDataNonEmptyString("fullname", knowledgebaseCommentRequest.FullName);
			}

			parameters.AppendRequestDataNonEmptyString("email", knowledgebaseCommentRequest.Email);

			if (knowledgebaseCommentRequest.ParentCommentId.HasValue)
			{
				parameters.AppendRequestDataNonNegativeInt("parentcommentid", knowledgebaseCommentRequest.ParentCommentId.Value);
			}

			return parameters;
		}
		public KnowledgebaseComment CreateKnowledgebaseComment(KnowledgebaseCommentRequest knowledgebaseCommentRequest)
		{
			RequestBodyBuilder parameters = PopulateRequestParameters(knowledgebaseCommentRequest, RequestTypes.Create);

			KnowledgebaseCommentCollection knowledgebaseComments = Connector.ExecutePost<KnowledgebaseCommentCollection>(KnowledgebaseCommentBaseUrl, parameters.ToString());

			if (knowledgebaseComments != null && knowledgebaseComments.Count > 0)
			{
				return knowledgebaseComments[0];
			}

			return null;
		}
        public void CreateKnowledgebaseComment()
        {
            var knowledgebaseCommentRequest = new KnowledgebaseCommentRequest
                {
                    KnowledgebaseArticleId = 1,
                    Contents = "Contents",
                    CreatorType = KnowledgebaseCommentCreatorType.User,
                    CreatorId = 3,
                    Email = "*****@*****.**",
                    ParentCommentId = 1
                };

            const string apiMethod = "/Knowledgebase/Comment";
            const string parameters = "knowledgebasearticleid=1&contents=Contents&creatortype=2&creatorid=3&[email protected]&parentcommentid=1";

            _kayakoApiRequest.Setup(x => x.ExecutePost<KnowledgebaseCommentCollection>(apiMethod, parameters)).Returns(_responseKnowledgebaseCommentCollection);

            var knowledgebaseComment = _knowledgebaseController.CreateKnowledgebaseComment(knowledgebaseCommentRequest);

            _kayakoApiRequest.Verify(x => x.ExecutePost<KnowledgebaseCommentCollection>(apiMethod, parameters), Times.Once());
            Assert.That(knowledgebaseComment, Is.EqualTo(_responseKnowledgebaseCommentCollection.First()));
        }