public void NewsItemCollectionDeserialization()
        {
            var newsItemCollection = new NewsItemCollection
            {
                new NewsItem
                {
                    Id                    = 41,
                    StaffId               = 1,
                    NewsItemType          = NewsItemType.Global,
                    NewsItemStatus        = NewsItemStatus.Published,
                    Author                = "Author full name",
                    Email                 = "*****@*****.**",
                    Subject               = "News subject",
                    EmailSubject          = "",
                    DateLine              = new UnixDateTime(1338237929),
                    Expiry                = new UnixDateTime(0),
                    IsSynced              = false,
                    TotalComments         = 0,
                    UserVisibilityCustom  = true,
                    UserGroupIdList       = new[] { 1, 2, 3 },
                    StaffVisibilityCustom = true,
                    StaffGroupIdList      = new[] { 1, 2 },
                    AllowComments         = true,
                    Contents              = "Test",
                    Categories            = new [] { 1, 2 }
                }
            };

            var expectedNewsItemCollection = XmlDataUtility.ReadFromFile <NewsItemCollection>("TestData/NewsItemCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsItemCollection, newsItemCollection);
        }
        public void TroubleshooterAttachmentCollectionDeserialization()
        {
            var troubleshooterAttachmentCollection = new TroubleshooterAttachmentCollection
            {
                new TroubleshooterAttachment
                {
                    Id = 24,
                    TroubleshooterStepId = 20,
                    FileName             = "file.xml",
                    FileSize             = 45380,
                    FileType             = "text/xml",
                    DateLine             = new UnixDateTime(1341315552),
                    Contents             = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                },
                new TroubleshooterAttachment
                {
                    Id = 26,
                    TroubleshooterStepId = 20,
                    FileName             = "file1.rar",
                    FileSize             = 3448,
                    FileType             = "application/rar",
                    DateLine             = new UnixDateTime(1341315640),
                    Contents             = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK=="
                }
            };

            var expectedTroubleshooterAttachmentCollection = XmlDataUtility.ReadFromFile <TroubleshooterAttachmentCollection>("TestData/TroubleshooterAttachmentCollection.xml");

            AssertUtility.ObjectsEqual(expectedTroubleshooterAttachmentCollection, troubleshooterAttachmentCollection);
        }
        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);
        }
        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);
        }
コード例 #5
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);
        }
コード例 #6
0
        public void KnowledgebaseCategoryCollectionDeserialization()
        {
            var knowledgebaseCategoryCollection = new KnowledgebaseCategoryCollection
            {
                new KnowledgebaseCategory
                {
                    Id = 70,
                    ParentKnowledgebaseCategoryId = 0,
                    StaffId               = 1,
                    Title                 = "category title",
                    TotalArticles         = 1,
                    CategoryType          = KnowledgebaseCategoryType.Inherit,
                    DisplayOrder          = 6,
                    AllowComments         = true,
                    UserVisibilityCustom  = false,
                    UserGroupIdList       = new[] { 1 },
                    StaffVisibilityCustom = false,
                    StaffGroupIdList      = new[] { 1 },
                    AllowRating           = true,
                    IsPublished           = true
                },
                new KnowledgebaseCategory
                {
                    Id = 79,
                    ParentKnowledgebaseCategoryId = 0,
                    StaffId               = 1,
                    Title                 = "The next one",
                    TotalArticles         = 6,
                    CategoryType          = KnowledgebaseCategoryType.Inherit,
                    DisplayOrder          = 7,
                    AllowComments         = true,
                    UserVisibilityCustom  = false,
                    UserGroupIdList       = new[] { 1 },
                    StaffVisibilityCustom = false,
                    StaffGroupIdList      = new[] { 1 },
                    AllowRating           = true,
                    IsPublished           = true
                }
            };

            var expectedKnowledgebaseCategoryCollection = XmlDataUtility.ReadFromFile <KnowledgebaseCategoryCollection>("TestData/KnowledgebaseCategoryCollection.xml");

            AssertUtility.ObjectsEqual(expectedKnowledgebaseCategoryCollection, knowledgebaseCategoryCollection);
        }
        public void NewsItemCommentCollectionDeserialization()
        {
            var newsItemCommentCollection = new NewsItemCommentCollection
            {
                new NewsItemComment
                {
                    Id              = 320,
                    NewsItemId      = 41,
                    CreatorType     = NewsItemCommentCreatorType.User,
                    CreatorId       = 1,
                    FullName        = "Jon doe",
                    Email           = string.Empty,
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1340037804),
                    ParentCommentId = 0,
                    CommentStatus   = NewsItemCommentStatus.Approved,
                    UserAgent       = string.Empty,
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Created by API on news"
                },
                new NewsItemComment
                {
                    Id              = 321,
                    NewsItemId      = 41,
                    CreatorType     = NewsItemCommentCreatorType.User,
                    CreatorId       = 1,
                    FullName        = "Simaranjit Singh",
                    Email           = string.Empty,
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1340037801),
                    ParentCommentId = 0,
                    CommentStatus   = NewsItemCommentStatus.Approved,
                    UserAgent       = string.Empty,
                    Referrer        = string.Empty,
                    ParentUrl       = string.Empty,
                    Contents        = "Created by API on news"
                }
            };

            var expectedNewsItemCommentCollection = XmlDataUtility.ReadFromFile <NewsItemCommentCollection>("TestData/NewsItemCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsItemCommentCollection, newsItemCommentCollection);
        }
コード例 #8
0
        public void TroubleshooterCommentCollectionDeserialization()
        {
            var troubleshooterCommentCollection = new TroubleshooterCommentCollection
            {
                new TroubleshooterComment
                {
                    Id = 325,
                    TroubleshooterStepId = 20,
                    CreatorType          = TroubleshooterCommentCreatorType.Staff,
                    CreatorId            = 1,
                    FullName             = "Jon doe",
                    Email           = "",
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1341311488),
                    ParentCommentId = 0,
                    CommentStatus   = TroubleshooterCommentStatus.MarkedAsSpam,
                    UserAgent       = "",
                    Referrer        = "",
                    ParentUrl       = "",
                    Contents        = "Contents"
                },
                new TroubleshooterComment
                {
                    Id = 326,
                    TroubleshooterStepId = 20,
                    CreatorType          = TroubleshooterCommentCreatorType.User,
                    CreatorId            = 1,
                    FullName             = "Mark",
                    Email           = "",
                    IpAddress       = "127.0.0.1",
                    DateLine        = new UnixDateTime(1341311488),
                    ParentCommentId = 0,
                    CommentStatus   = TroubleshooterCommentStatus.PendingForApproval,
                    UserAgent       = "",
                    Referrer        = "",
                    ParentUrl       = "",
                    Contents        = "Contents of a comment"
                }
            };

            var expectedTroubleshooterCommentCollection = XmlDataUtility.ReadFromFile <TroubleshooterCommentCollection>("TestData/TroubleshooterCommentCollection.xml");

            AssertUtility.ObjectsEqual(expectedTroubleshooterCommentCollection, troubleshooterCommentCollection);
        }
        public void CustomFieldCollectionDeserialization()
        {
            var customFieldCollection = new CustomFieldCollection
            {
                new CustomField
                {
                    CustomFieldId      = 1,
                    CustomFieldGroupId = 1,
                    Title             = "Customer ID",
                    FieldType         = CustomFieldFieldType.Text,
                    FieldName         = "cn4ezfbjzyoj",
                    DefaultValue      = "",
                    IsRequired        = false,
                    UserEditable      = false,
                    StaffEditable     = true,
                    RegexValidate     = "",
                    DisplayOrder      = 1,
                    EncryptInDatabase = false,
                    Description       = ""
                },
                new CustomField
                {
                    CustomFieldId      = 2,
                    CustomFieldGroupId = 1,
                    Title             = "Product",
                    FieldType         = CustomFieldFieldType.Select,
                    FieldName         = "llcut44uri9d",
                    DefaultValue      = "",
                    IsRequired        = false,
                    UserEditable      = false,
                    StaffEditable     = true,
                    RegexValidate     = "",
                    DisplayOrder      = 2,
                    EncryptInDatabase = false,
                    Description       = ""
                }
            };

            var expectedCustomFieldCollection = XmlDataUtility.ReadFromFile <CustomFieldCollection>("TestData/CustomFieldCollection.xml");

            AssertUtility.ObjectsEqual(expectedCustomFieldCollection, customFieldCollection);
        }
        public void TroubleshooterCategoryCollectionDeserialization()
        {
            var troubleshooterCategoryCollection = new TroubleshooterCategoryCollection
            {
                new TroubleshooterCategory
                {
                    Id                    = 1,
                    StaffId               = 0,
                    StaffName             = "",
                    Title                 = "General",
                    Description           = "",
                    CategoryType          = TroubleshooterCategoryType.Global,
                    DisplayOrder          = 1,
                    Views                 = 22,
                    UserVisibilityCustom  = false,
                    UserGroupIdList       = new int[0],
                    StaffVisibilityCustom = false,
                    StaffGroupIdList      = new int[0]
                },
                new TroubleshooterCategory
                {
                    Id                    = 2,
                    StaffId               = 1,
                    StaffName             = "",
                    Title                 = "New",
                    Description           = "",
                    CategoryType          = TroubleshooterCategoryType.Public,
                    DisplayOrder          = 1,
                    Views                 = 22,
                    UserVisibilityCustom  = true,
                    UserGroupIdList       = new [] { 1, 2 },
                    StaffVisibilityCustom = true,
                    StaffGroupIdList      = new [] { 1, 3 }
                }
            };

            var expectedTroubleshooterCategoryCollection = XmlDataUtility.ReadFromFile <TroubleshooterCategoryCollection>("TestData/TroubleshooterCategoryCollection.xml");

            AssertUtility.ObjectsEqual(expectedTroubleshooterCategoryCollection, troubleshooterCategoryCollection);
        }
        public void DepartmentCollectionDeserialization()
        {
            var expectedDepartments = new DepartmentCollection
            {
                new Department
                {
                    Id                   = 2,
                    Title                = "Title",
                    Type                 = DepartmentType.Private,
                    Module               = DepartmentModule.LiveChat,
                    DisplayOrder         = 3,
                    ParentDepartmentId   = 1,
                    UserVisibilityCustom = false,
                    UserGroups           = new List <int> {
                        1, 2, 3
                    }
                }
            };

            var actualDepartments = XmlDataUtility.ReadFromFile <DepartmentCollection>("TestData/DepartmentCollection.xml");

            AssertUtility.ObjectsEqual(expectedDepartments, actualDepartments);
        }
        public void NewsSubscirberCollectionDeserialization()
        {
            var newsSubscriberCollection = new NewsSubscriberCollection
            {
                new NewsSubscriber
                {
                    Id          = 1,
                    TGroupId    = 1,
                    UserId      = 0,
                    Email       = "*****@*****.**",
                    IsValidated = false,
                    UserGroupId = 1
                },
                new NewsSubscriber
                {
                    Id          = 2,
                    TGroupId    = 1,
                    UserId      = 0,
                    Email       = "*****@*****.**",
                    IsValidated = true,
                    UserGroupId = 1
                },
                new NewsSubscriber
                {
                    Id          = 3,
                    TGroupId    = 1,
                    UserId      = 0,
                    Email       = "*****@*****.**",
                    IsValidated = false,
                    UserGroupId = 1
                }
            };

            var expectedNewsSubscriberCollection = XmlDataUtility.ReadFromFile <NewsSubscriberCollection>("TestData/NewsSubscriberCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsSubscriberCollection, newsSubscriberCollection);
        }
コード例 #13
0
        public void NewsCategoryCollectionDeserialization()
        {
            var newsCategoryCollection = new NewsCategoryCollection
            {
                new NewsCategory
                {
                    Id             = 1,
                    Title          = "First",
                    NewsItemCount  = 14,
                    VisibilityType = NewsCategoryVisibilityType.Public
                },
                new NewsCategory
                {
                    Id             = 2,
                    Title          = "Second",
                    NewsItemCount  = 14,
                    VisibilityType = NewsCategoryVisibilityType.Private
                }
            };

            var expectedNewsCategoryCollection = XmlDataUtility.ReadFromFile <NewsCategoryCollection>("TestData/NewsCategoryCollection.xml");

            AssertUtility.ObjectsEqual(expectedNewsCategoryCollection, newsCategoryCollection);
        }
        public void TroubleshooterStepsCollectionDeserialization()
        {
            var troubleshooterStepsCollection = new TroubleshooterStepCollection
            {
                new TroubleshooterStep
                {
                    Id              = 25,
                    CategoryId      = 1,
                    StaffId         = 1,
                    StaffName       = "admin admin",
                    Subject         = "Troubleshooter step subject",
                    Edited          = false,
                    EditedStaffId   = 0,
                    EditedStaffName = "",
                    DisplayOrder    = 15,
                    Views           = 0,
                    AllowComments   = true,
                    HasAttachments  = false,
                    Attachments     = new []
                    {
                        new TroubleshooterStepAttachment
                        {
                            Id       = 3,
                            FileName = "attachement.txt",
                            FileSize = "0.01 KB",
                            Link     = "http://jamietestingagain.kayako.com/api/Troubleshooter/Step/GetAttachment/1/1/3"
                        }
                    },
                    ParentSteps          = new [] { 0 },
                    ChildSteps           = new int[0],
                    RedirectTickets      = true,
                    TicketSubject        = "",
                    RedirectDepartmentId = 0,
                    TicketTypeId         = 0,
                    TicketPriorityId     = 0,
                    Contents             = "Troubleshooter step contents"
                },
                new TroubleshooterStep
                {
                    Id                   = 28,
                    CategoryId           = 1,
                    StaffId              = 1,
                    StaffName            = "admin admin",
                    Subject              = "Troubleshooter subject",
                    Edited               = false,
                    EditedStaffId        = 0,
                    EditedStaffName      = "",
                    DisplayOrder         = 17,
                    Views                = 0,
                    AllowComments        = true,
                    HasAttachments       = false,
                    ParentSteps          = new [] { 0 },
                    ChildSteps           = new int[0],
                    RedirectTickets      = true,
                    TicketSubject        = "",
                    RedirectDepartmentId = 0,
                    TicketTypeId         = 0,
                    TicketPriorityId     = 0,
                    Contents             = "Troubleshooter step contents"
                }
            };

            var expectedTroubleshooterStepCollection = XmlDataUtility.ReadFromFile <TroubleshooterStepCollection>("TestData/TroubleshooterStepsCollection.xml");

            AssertUtility.ObjectsEqual(expectedTroubleshooterStepCollection, troubleshooterStepsCollection);
        }
        public void TicketCustomFieldCollectionDeserialization()
        {
            var ticketcustomFields = new TicketCustomFields
            {
                FieldGroups = new List <TicketCustomFieldGroup>
                {
                    new TicketCustomFieldGroup
                    {
                        Id     = 4,
                        Title  = "Test Ticket",
                        Fields = new []
                        {
                            new TicketCustomField
                            {
                                Id           = 2,
                                Type         = TicketCustomFieldType.Text,
                                Name         = "ab32ds122",
                                Title        = "Test",
                                FieldContent = "Test Plaintext Field"
                            },
                            new TicketCustomField
                            {
                                Id           = 3,
                                Type         = TicketCustomFieldType.LinkedSelectFields,
                                Name         = "fd923nds2",
                                Title        = "Linked Select",
                                FieldContent = "Product > Fusion"
                            },
                            new TicketCustomField
                            {
                                Id           = 4,
                                Type         = TicketCustomFieldType.MultiSelect,
                                Name         = "mcz923nxa",
                                Title        = "Multiple",
                                FieldContent = "Value1, Value2"
                            },
                            new TicketCustomField
                            {
                                Id           = 5,
                                Type         = TicketCustomFieldType.Date,
                                Name         = "z13nc8923",
                                Title        = "Date",
                                FieldContent = "05/24/2011"
                            },
                            new TicketCustomField
                            {
                                Id           = 6,
                                Type         = TicketCustomFieldType.File,
                                FileName     = "report.txt",
                                Name         = "mds923nx92",
                                Title        = "File",
                                FieldContent = "VTFkSlJsUXRNVE01TURvZ1EzVnpkRzl0SUVacFpXeGtjeUJwYmlCVWFXTnJaWFFnVm1sbGQzTUtDbE5YU1VaVUxURXpPVEU2SUZCMVlteHBZeTlRY21sMllYUmxJRlpwYzJsaWFXeHBkSGtnVkc5bloyeGxJR2x1SUZWelpYSXZWWE5sY2lCUGNtZGhibWw2WVhScGIyNGdRM1Z6ZEc5dElFWnBaV3hrSUVkeWIzVndjd29L"
                            }
                        }
                    }
                }
            };

            var expectedTicketCustomFields = XmlDataUtility.ReadFromFile <TicketCustomFields>("TestData/TicketCustomFields.xml");

            AssertUtility.ObjectsEqual(expectedTicketCustomFields, ticketcustomFields);
        }