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() }; }
public void GetAllTroubleshooterSteps() { TroubleshooterStepCollection troubleshooterSteps = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterSteps(); Assert.IsNotNull(troubleshooterSteps, "No troubleshooter steps were returned"); Assert.IsNotEmpty(troubleshooterSteps, "No troubleshooter steps were returned"); }
public TroubleshooterStep CreateTroubleshooterStep(TroubleshooterStepRequest troubleshooterStepRequest) { RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterStepRequest, RequestTypes.Create); TroubleshooterStepCollection troubleshooterSteps = Connector.ExecutePost <TroubleshooterStepCollection>(TroubleshooterStepBaseUrl, parameters.ToString()); if (troubleshooterSteps != null && troubleshooterSteps.Count > 0) { return(troubleshooterSteps[0]); } return(null); }
public TroubleshooterStep GetTroubleshooterStep(int troubleshooterStepId) { string apiMethod = String.Format("{0}/{1}", TroubleshooterStepBaseUrl, troubleshooterStepId); TroubleshooterStepCollection troubleshooterSteps = Connector.ExecuteGet <TroubleshooterStepCollection>(apiMethod); if (troubleshooterSteps != null && troubleshooterSteps.Count > 0) { return(troubleshooterSteps[0]); } return(null); }
public void GetAllTroubleshooterComments() { TroubleshooterStepCollection troubleshooterSteps = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterSteps(); Assert.IsNotNull(troubleshooterSteps, "No troubleshooter steps were returned"); Assert.IsNotEmpty(troubleshooterSteps, "No troubleshooter steps were returned"); TroubleshooterStep troubleshooterStepToGet = troubleshooterSteps[new Random().Next(troubleshooterSteps.Count)]; TroubleshooterCommentCollection troubleshooterComments = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterComments(troubleshooterStepToGet.Id); Assert.IsNotNull(troubleshooterComments, "No troubleshooter comments were returned"); Assert.IsNotEmpty(troubleshooterComments, "No troubleshooter comments were returned"); }
public TroubleshooterStep UpdateTroubleshooterStep(TroubleshooterStepRequest troubleshooterStepRequest) { string apiMethod = String.Format("{0}/{1}", TroubleshooterStepBaseUrl, troubleshooterStepRequest.Id); RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterStepRequest, RequestTypes.Update); TroubleshooterStepCollection troubleshooterStep = Connector.ExecutePut <TroubleshooterStepCollection>(apiMethod, parameters.ToString()); if (troubleshooterStep != null && troubleshooterStep.Count > 0) { return(troubleshooterStep[0]); } return(null); }
public void GetTroubleshooterStep() { TroubleshooterStepCollection troubleshooterSteps = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterSteps(); Assert.IsNotNull(troubleshooterSteps, "No troubleshooter steps were returned"); Assert.IsNotEmpty(troubleshooterSteps, "No troubleshooter steps were returned"); TroubleshooterStep troubleshooterStepToGet = troubleshooterSteps[new Random().Next(troubleshooterSteps.Count)]; Trace.WriteLine("GetTroubleshooterStep using troubleshooter step id: " + troubleshooterStepToGet.Id); TroubleshooterStep troubleshooterStep = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterStep(troubleshooterStepToGet.Id); AssertObjectXmlEqual(troubleshooterStep, troubleshooterStepToGet); }
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() }; }
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 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); }