public void GetAllKnowledgebaseArticles()
        {
            KnowledgebaseArticleCollection knowledgebaseArticles = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticles();

            Assert.IsNotNull(knowledgebaseArticles, "No knowledgebase articles were returned");
            Assert.IsNotEmpty(knowledgebaseArticles, "No knowledgebase articles were returned");
        }
Esempio n. 2
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()
            };
        }
        public void KnowledgebaseArticleCollectionDeserialization()
        {
            var knowledgebaseArticleCollection = new KnowledgebaseArticleCollection
            {
                new KnowledgebaseArticle
                {
                    Id             = 1,
                    Contents       = "Contents",
                    ContentsText   = "Contents",
                    Categories     = new[] { 0 },
                    Creator        = 2,
                    CreatorId      = 1,
                    Author         = "Simaranjit Singh",
                    Email          = "*****@*****.**",
                    Subject        = "Subject",
                    IsEdited       = true,
                    EditedDateLine = new UnixDateTime(1336757517),
                    EditedStaffId  = 1,
                    Views          = 24,
                    IsFeatured     = false,
                    AllowComments  = true,
                    TotalComments  = 0,
                    HasAttachments = true,
                    Attachments    = new[]
                    {
                        new KnowledgebaseArticleAttachment
                        {
                            Id       = 4,
                            FileName = "photo.jpg",
                            FileSize = "88.42 KB",
                            Link     = string.Empty
                        },
                        new KnowledgebaseArticleAttachment
                        {
                            Id       = 5,
                            FileName = "cap_ture1.png",
                            FileSize = "8.99 KB",
                            Link     = string.Empty
                        },
                        new KnowledgebaseArticleAttachment
                        {
                            Id       = 20,
                            FileName = "abcde.txt",
                            FileSize = "0.00 KB",
                            Link     = string.Empty
                        }
                    },
                    DateLine      = new UnixDateTime(1335437662),
                    ArticleStatus = KnowledgebaseArticleStatus.Published,
                    ArticleRating = 0,
                    RatingHits    = 0,
                    RatingCount   = 0
                }
            };

            var expectedKnowledgebaseArticleCollection = XmlDataUtility.ReadFromFile <KnowledgebaseArticleCollection>("TestData/KnowledgebaseArticleCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseArticleCollection, knowledgebaseArticleCollection);
        }
        public void KnowledgebaseArticleCollectionDeserialization()
        {
            var knowledgebaseArticleCollection = new KnowledgebaseArticleCollection
                {
                    new KnowledgebaseArticle
                        {
                            Id = 1,
                            Contents = "Contents",
                            ContentsText = "Contents",
                            Categories = new [] { 0 },
                            Creator = 2,
                            CreatorId = 1,
                            Author = "Simaranjit Singh",
                            Email = "*****@*****.**",
                            Subject = "Subject",
                            IsEdited = true,
                            EditedDateLine = new UnixDateTime(1336757517),
                            EditedStaffId = 1,
                            Views = 24,
                            IsFeatured = false,
                            AllowComments = true,
                            TotalComments = 0,
                            HasAttachments = true,
                            Attachments = new []
                                {
                                    new KnowledgebaseArticleAttachment
                                        {
                                            Id = 4,
                                            FileName = "photo.jpg",
                                            FileSize = "88.42 KB",
                                            Link = ""
                                        },
                                    new KnowledgebaseArticleAttachment
                                        {
                                            Id = 5,
                                            FileName = "cap_ture1.png",
                                            FileSize = "8.99 KB",
                                            Link = ""
                                        },
                                    new KnowledgebaseArticleAttachment
                                        {
                                            Id = 20,
                                            FileName = "abcde.txt",
                                            FileSize = "0.00 KB",
                                            Link = ""
                                        }
                                },
                            DateLine = new UnixDateTime(1335437662),
                            ArticleStatus = KnowledgebaseArticleStatus.Published,
                            ArticleRating = 0,
                            RatingHits = 0,
                            RatingCount = 0
                        }
                };

            var expectedKnowledgebaseArticleCollection = XmlDataUtility.ReadFromFile<KnowledgebaseArticleCollection>("TestData/KnowledgebaseArticleCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseArticleCollection, knowledgebaseArticleCollection);
        }
Esempio n. 5
0
        public KnowledgebaseArticle CreateKnowledgebaseArticle(KnowledgebaseArticleRequest knowledgebaseArticleRequest)
        {
            RequestBodyBuilder parameters = PopulateRequestParameters(knowledgebaseArticleRequest, RequestTypes.Create);

            KnowledgebaseArticleCollection knowledgebaseArticles = Connector.ExecutePost <KnowledgebaseArticleCollection>(KnowledgebaseArticleBaseUrl, parameters.ToString());

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

            return(null);
        }
Esempio n. 6
0
        public KnowledgebaseArticle GetKnowledgebaseArticle(int knowledgebaseArticleId)
        {
            string apiMethod = String.Format("{0}/{1}", KnowledgebaseArticleBaseUrl, knowledgebaseArticleId);

            KnowledgebaseArticleCollection knowledgebaseArticles = Connector.ExecuteGet <KnowledgebaseArticleCollection>(apiMethod);

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

            return(null);
        }
Esempio n. 7
0
        public KnowledgebaseArticle UpdateKnowledgebaseArticle(KnowledgebaseArticleRequest knowledgebaseArticleRequest)
        {
            string             apiMethod  = String.Format("{0}/{1}", KnowledgebaseArticleBaseUrl, knowledgebaseArticleRequest.Id);
            RequestBodyBuilder parameters = PopulateRequestParameters(knowledgebaseArticleRequest, RequestTypes.Update);

            KnowledgebaseArticleCollection knowledgebaseArticles = Connector.ExecutePut <KnowledgebaseArticleCollection>(apiMethod, parameters.ToString());

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

            return(null);
        }
        public void GetKnowledgebaseArticle()
        {
            KnowledgebaseArticleCollection knowledgebaseArticles = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticles();

            Assert.IsNotNull(knowledgebaseArticles, "No knowledgebase articles were returned");
            Assert.IsNotEmpty(knowledgebaseArticles, "No knowledgebase articles were returned");

            KnowledgebaseArticle knowledgebaseArticleToGet = knowledgebaseArticles[new Random().Next(knowledgebaseArticles.Count)];

            Trace.WriteLine("GetKnowledgebaseArticle using knowledgebase article id: " + knowledgebaseArticleToGet.Id);

            KnowledgebaseArticle knowledgebaseArticle = TestSetup.KayakoApiService.Knowledgebase.GetKnowledgebaseArticle(knowledgebaseArticleToGet.Id);

            AssertObjectXmlEqual(knowledgebaseArticle, knowledgebaseArticleToGet);
        }
        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()
                };
        }