Esempio n. 1
0
        public void Setup()
        {
            _kayakoApiRequest        = new Mock <IKayakoApiRequest>();
            _knowledgebaseController = new KnowledgebaseController(_kayakoApiRequest.Object);

            _responseKnowledgebaseCategoryCollection = new KnowledgebaseCategoryCollection
            {
                new KnowledgebaseCategory(),
                new KnowledgebaseCategory()
            };

            _responseKnowledgebaseArticleCollection = new KnowledgebaseArticleCollection
            {
                new KnowledgebaseArticle(),
                new KnowledgebaseArticle()
            };

            _responseKnowledgebaseCommentCollection = new KnowledgebaseCommentCollection
            {
                new KnowledgebaseComment(),
                new KnowledgebaseComment()
            };

            _responseKnowledgebaseAttachmentCollection = new KnowledgebaseAttachmentCollection
            {
                new KnowledgebaseAttachment(),
                new KnowledgebaseAttachment()
            };
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public KnowledgebaseComment GetKnowledgebaseComment(int knowledgebaseCommentId)
        {
            string apiMethod = String.Format("{0}/{1}", KnowledgebaseCommentBaseUrl, knowledgebaseCommentId);

            KnowledgebaseCommentCollection knowledgebaseComments = Connector.ExecuteGet <KnowledgebaseCommentCollection>(apiMethod);

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

            return(null);
        }
Esempio n. 4
0
        public void KnowledgebaseCommentCollectionDeserialization()
        {
            var knowledgebaseCommentCollection = new KnowledgebaseCommentCollection
            {
                new KnowledgebaseComment
                {
                    Id = 17,
                    KnowledgebaseArticleId = 1,
                    CreatorType            = KnowledgebaseCommentCreatorType.User,
                    CreatorId       = 1,
                    FullName        = "Simaranjit Singh",
                    Email           = string.Empty,
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1339786410),
                    ParentCommentId = 0,
                    CommentStatus   = KnowledgebaseCommentStatus.Approved,
                    UserAgent       = string.Empty,
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Comment1"
                },
                new KnowledgebaseComment
                {
                    Id = 19,
                    KnowledgebaseArticleId = 1,
                    CreatorType            = KnowledgebaseCommentCreatorType.User,
                    CreatorId       = 0,
                    FullName        = "John",
                    Email           = "*****@*****.**",
                    IpAddress       = "::1",
                    DateLine        = new UnixDateTime(1339787502),
                    ParentCommentId = 0,
                    CommentStatus   = KnowledgebaseCommentStatus.Approved,
                    UserAgent       = "Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20100101 Firefox/13.0",
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Comment2"
                }
            };

            var expectedKnowledgebaseCommentCollection = XmlDataUtility.ReadFromFile <KnowledgebaseCommentCollection>("TestData/KnowledgebaseCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseCommentCollection, knowledgebaseCommentCollection);
        }
        public void KnowledgebaseCommentCollectionDeserialization()
        {
            var knowledgebaseCommentCollection = new KnowledgebaseCommentCollection
                {
                    new KnowledgebaseComment
                        {
                            Id = 17,
                            KnowledgebaseArticleId = 1,
                            CreatorType = KnowledgebaseCommentCreatorType.User,
                            CreatorId = 1,
                            FullName = "Simaranjit Singh",
                            Email = "",
                            IpAddress = "127.0.0.1",
                            DateLine = new UnixDateTime(1339786410),
                            ParentCommentId = 0,
                            CommentStatus = KnowledgebaseCommentStatus.Approved,
                            UserAgent = "",
                            Referrer = "",
                            ParentUrl = "",
                            Contents = "Comment1"
                        },
                    new KnowledgebaseComment
                        {
                            Id = 19,
                            KnowledgebaseArticleId = 1,
                            CreatorType = KnowledgebaseCommentCreatorType.User,
                            CreatorId = 0,
                            FullName = "John",
                            Email = "*****@*****.**",
                            IpAddress = "::1",
                            DateLine = new UnixDateTime(1339787502),
                            ParentCommentId = 0,
                            CommentStatus = KnowledgebaseCommentStatus.Approved,
                            UserAgent = "Mozilla/5.0 (Windows NT 6.1; rv:13.0) Gecko/20100101 Firefox/13.0",
                            Referrer = "",
                            ParentUrl = "",
                            Contents = "Comment2"
                        }
                };

            var expectedKnowledgebaseCommentCollection = XmlDataUtility.ReadFromFile<KnowledgebaseCommentCollection>("TestData/KnowledgebaseCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseCommentCollection, knowledgebaseCommentCollection);
        }
        public void Setup()
        {
            _kayakoApiRequest = new Mock<IKayakoApiRequest>();
            _knowledgebaseController = new KnowledgebaseController(_kayakoApiRequest.Object);

            _responseKnowledgebaseCategoryCollection = new KnowledgebaseCategoryCollection
                {
                    new KnowledgebaseCategory(),
                    new KnowledgebaseCategory()
                };

            _responseKnowledgebaseArticleCollection = new KnowledgebaseArticleCollection
                {
                    new KnowledgebaseArticle(),
                    new KnowledgebaseArticle()
                };

            _responseKnowledgebaseCommentCollection = new KnowledgebaseCommentCollection
                {
                    new KnowledgebaseComment(),
                    new KnowledgebaseComment()
                };

            _responseKnowledgebaseAttachmentCollection = new KnowledgebaseAttachmentCollection
                {
                    new KnowledgebaseAttachment(),
                    new KnowledgebaseAttachment()
                };
        }