public void CreateUpdateDeleteNewsSubscriber()
        {
            var users = TestSetup.KayakoApiService.Users.GetUsers();

            Assert.IsNotNull(users);
            Assert.IsNotEmpty(users);

            var newsItemCommentRequest = new NewsItemCommentRequest
            {
                NewsItemId = 1,
                Contents = "Contents of a comment",
                CreatorType = NewsItemCommentCreatorType.User,
                CreatorId = users.FirstOrDefault().Id
            };

            var newsItemComment = TestSetup.KayakoApiService.News.CreateNewsItemComment(newsItemCommentRequest);

            Assert.IsNotNull(newsItemComment);
            Assert.That(newsItemComment.NewsItemId, Is.EqualTo(newsItemCommentRequest.NewsItemId));
            Assert.That(newsItemComment.Contents, Is.EqualTo(newsItemCommentRequest.Contents));
            Assert.That(newsItemComment.CreatorType, Is.EqualTo(newsItemCommentRequest.CreatorType));
            Assert.That(newsItemComment.CreatorId, Is.EqualTo(newsItemCommentRequest.CreatorId));

            var deleteSuccess = TestSetup.KayakoApiService.News.DeleteNewsItemComment(newsItemComment.Id);

            Assert.IsTrue(deleteSuccess);
        }
		public static NewsItemComment ToResponseData(NewsItemCommentRequest requestData)
		{
			return ToResponseType<NewsItemCommentRequest, NewsItemComment>(requestData);
		}
        public void CreateNewsItemComment()
        {
            var newsItemCommentRequest = new NewsItemCommentRequest
                {
                    NewsItemId = 1,
                    Contents = "Contents",
                    CreatorType = NewsItemCommentCreatorType.Staff,
                    CreatorId = 1,
                    FullName = "FullName",
                    Email = "*****@*****.**",
                    ParentCommentId = 3
                };

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

            _kayakoApiRequest.Setup(x => x.ExecutePost<NewsItemCommentCollection>(apiMethod, parameters)).Returns(_responseNewsItemCommentCollection);

            var newsItemComment = _newsController.CreateNewsItemComment(newsItemCommentRequest);

            _kayakoApiRequest.Verify(x => x.ExecutePost<NewsItemCommentCollection>(apiMethod, parameters), Times.Once());
            Assert.That(newsItemComment, Is.EqualTo(_responseNewsItemCommentCollection.FirstOrDefault()));
        }
 public static NewsItemComment ToResponseData(NewsItemCommentRequest requestData) => ToResponseType <NewsItemCommentRequest, NewsItemComment>(requestData);
 public static NewsItemComment ToResponseData(NewsItemCommentRequest requestData)
 {
     return(ToResponseType <NewsItemCommentRequest, NewsItemComment>(requestData));
 }
		public NewsItemComment CreateNewsItemComment(NewsItemCommentRequest newsItemCommentRequest)
		{
			newsItemCommentRequest.EnsureValidData(RequestTypes.Create);

			RequestBodyBuilder parameters = new RequestBodyBuilder();
			parameters.AppendRequestData("newsitemid", newsItemCommentRequest.NewsItemId);
			parameters.AppendRequestDataNonEmptyString("contents", newsItemCommentRequest.Contents);
			parameters.AppendRequestData("creatortype", EnumUtility.ToApiString(newsItemCommentRequest.CreatorType));

			if (newsItemCommentRequest.CreatorId != null)
			{
				parameters.AppendRequestData("creatorid", newsItemCommentRequest.CreatorId);
			}
			else
			{
				parameters.AppendRequestDataNonEmptyString("fullname", newsItemCommentRequest.FullName);
			}

			parameters.AppendRequestDataNonEmptyString("email", newsItemCommentRequest.Email);
			parameters.AppendRequestData("parentcommentid", newsItemCommentRequest.ParentCommentId);

			var newsItemComments = Connector.ExecutePost<NewsItemCommentCollection>(NewsItemCommentBaseUrl, parameters.ToString());

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

			return null;
		}