public void KnowledgebaseAttachmentCollectionDeserialization()
        {
            var knowledgebaseAttachmentCollection = new KnowledgebaseAttachmentCollection
            {
                new KnowledgebaseAttachment
                {
                    Id = 4,
                    KnowledgebaseArticleId = 1,
                    FileName = "image.jpg",
                    FileSize = 90543,
                    FileType = "image/jpeg",
                    DateLine = new UnixDateTime(1335819066),
                    Contents = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                },
                new KnowledgebaseAttachment
                {
                    Id = 4,
                    KnowledgebaseArticleId = 1,
                    FileName = "image1.jpg",
                    FileSize = 90549,
                    FileType = "image/jpeg",
                    DateLine = new UnixDateTime(1335819066),
                    Contents = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                }
            };

            var expectedKnowledgebaseAttachmentCollection = XmlDataUtility.ReadFromFile <KnowledgebaseAttachmentCollection>("TestData/KnowledgebaseAttachmentCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseAttachmentCollection, knowledgebaseAttachmentCollection);
        }
Beispiel #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 KnowledgebaseAttachmentCollectionDeserialization()
        {
            var knowledgebaseAttachmentCollection = new KnowledgebaseAttachmentCollection
                {
                    new KnowledgebaseAttachment
                        {
                            Id = 4,
                            KnowledgebaseArticleId = 1,
                            FileName = "image.jpg",
                            FileSize = 90543,
                            FileType = "image/jpeg",
                            DateLine = new UnixDateTime(1335819066),
                            Contents = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                        },
                    new KnowledgebaseAttachment
                        {
                            Id = 4,
                            KnowledgebaseArticleId = 1,
                            FileName = "image1.jpg",
                            FileSize = 90549,
                            FileType = "image/jpeg",
                            DateLine = new UnixDateTime(1335819066),
                            Contents = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                        }
                };

            var expectedKnowledgebaseAttachmentCollection = XmlDataUtility.ReadFromFile<KnowledgebaseAttachmentCollection>("TestData/KnowledgebaseAttachmentCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseAttachmentCollection, knowledgebaseAttachmentCollection);
        }
Beispiel #4
0
        public KnowledgebaseAttachment GetKnowledgebaseAttachment(int knowledgebaseArticleId, int attachmentId)
        {
            string apiMethod = string.Format("{0}/{1}/{2}", KnowledgebaseAttachmentBaseUrl, knowledgebaseArticleId, attachmentId);

            KnowledgebaseAttachmentCollection knowledgebaseAttachments = Connector.ExecuteGet <KnowledgebaseAttachmentCollection>(apiMethod);

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

            return(null);
        }
Beispiel #5
0
        public KnowledgebaseAttachment CreateKnowledgebaseAttachment(KnowledgebaseAttachmentRequest knowledgebaseAttachmentRequest)
        {
            const string       apiMethod  = KnowledgebaseAttachmentBaseUrl;
            RequestBodyBuilder parameters = PopulateRequestParameters(knowledgebaseAttachmentRequest, RequestTypes.Create);

            KnowledgebaseAttachmentCollection knowledgebaseAttachments = Connector.ExecutePost <KnowledgebaseAttachmentCollection>(apiMethod, parameters.ToString());

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

            return(null);
        }
        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()
                };
        }