Ejemplo n.º 1
0
        public void GetAllTroubleshooterCategories()
        {
            TroubleshooterCategoryCollection troubleshooterCategories = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterCategories();

            Assert.IsNotNull(troubleshooterCategories, "No troubleshooter categories were returned");
            Assert.IsNotEmpty(troubleshooterCategories, "No troubleshooter categories were returned");
        }
        public void Setup()
        {
            _kayakoApiRequest         = new Mock <IKayakoApiRequest>();
            _troubleshooterController = new TroubleshooterController(_kayakoApiRequest.Object);

            _responseTroubleshooterCategoryCollection = new TroubleshooterCategoryCollection
            {
                new TroubleshooterCategory(),
                new TroubleshooterCategory()
            };

            _responseTroubleshooterStepCollection = new TroubleshooterStepCollection
            {
                new TroubleshooterStep(),
                new TroubleshooterStep()
            };

            _responseTroubleshooterCommentCollection = new TroubleshooterCommentCollection
            {
                new TroubleshooterComment(),
                new TroubleshooterComment()
            };

            _responseTroubleshooterAttachmentCollection = new TroubleshooterAttachmentCollection
            {
                new TroubleshooterAttachment(),
                new TroubleshooterAttachment()
            };
        }
Ejemplo n.º 3
0
        public TroubleshooterCategory CreateTroubleshooterCategory(TroubleshooterCategoryRequest troubleshooterCategoryRequest)
        {
            RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterCategoryRequest, RequestTypes.Create);

            TroubleshooterCategoryCollection troubleshooterCategories = Connector.ExecutePost <TroubleshooterCategoryCollection>(TroubleshooterCategoryBaseUrl, parameters.ToString());

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

            return(null);
        }
Ejemplo n.º 4
0
        public TroubleshooterCategory GetTroubleshooterCategory(int troubleshooterCategoryId)
        {
            string apiMethod = String.Format("{0}/{1}", TroubleshooterCategoryBaseUrl, troubleshooterCategoryId);

            TroubleshooterCategoryCollection troubleshooterCategories = Connector.ExecuteGet <TroubleshooterCategoryCollection>(apiMethod);

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

            return(null);
        }
Ejemplo n.º 5
0
        public TroubleshooterCategory UpdateTroubleshooterCategory(TroubleshooterCategoryRequest troubleshooterCategoryRequest)
        {
            string             apiMethod  = String.Format("{0}/{1}", TroubleshooterCategoryBaseUrl, troubleshooterCategoryRequest.Id);
            RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterCategoryRequest, RequestTypes.Update);

            TroubleshooterCategoryCollection troubleshooterCategories = Connector.ExecutePut <TroubleshooterCategoryCollection>(apiMethod, parameters.ToString());

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

            return(null);
        }
Ejemplo n.º 6
0
        public void GetTroubleshooterCategory()
        {
            TroubleshooterCategoryCollection troubleshooterCategories = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterCategories();

            Assert.IsNotNull(troubleshooterCategories, "No troubleshooter categories were returned");
            Assert.IsNotEmpty(troubleshooterCategories, "No troubleshooter categories were returned");

            TroubleshooterCategory troubleshooterCategoryToGet = troubleshooterCategories[new Random().Next(troubleshooterCategories.Count)];

            Trace.WriteLine("GetTroubleshooterCategory using troubleshooter category id: " + troubleshooterCategoryToGet.Id);

            TroubleshooterCategory troubleshooterCategory = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterCategory(troubleshooterCategoryToGet.Id);

            AssertObjectXmlEqual(troubleshooterCategory, troubleshooterCategoryToGet);
        }
        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 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 Setup()
        {
            _kayakoApiRequest = new Mock<IKayakoApiRequest>();
            _troubleshooterController = new TroubleshooterController(_kayakoApiRequest.Object);

            _responseTroubleshooterCategoryCollection = new TroubleshooterCategoryCollection
                {
                    new TroubleshooterCategory(),
                    new TroubleshooterCategory()
                };

            _responseTroubleshooterStepCollection = new TroubleshooterStepCollection
                {
                    new TroubleshooterStep(),
                    new TroubleshooterStep()
                };

            _responseTroubleshooterCommentCollection = new TroubleshooterCommentCollection
                {
                    new TroubleshooterComment(),
                    new TroubleshooterComment()
                };

            _responseTroubleshooterAttachmentCollection = new TroubleshooterAttachmentCollection
                {
                    new TroubleshooterAttachment(),
                    new TroubleshooterAttachment()
                };
        }