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()
            };
        }
Exemplo n.º 2
0
        public TroubleshooterComment CreateTroubleshooterComment(TroubleshooterCommentRequest troubleshooterCommentRequest)
        {
            RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterCommentRequest, RequestTypes.Create);

            TroubleshooterCommentCollection troubleshooterComments = Connector.ExecutePost <TroubleshooterCommentCollection>(TroubleshooterCommentBaseUrl, parameters.ToString());

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

            return(null);
        }
Exemplo n.º 3
0
        public TroubleshooterComment GetTroubleshooterComment(int troubleshooterCommentId)
        {
            string apiMethod = String.Format("{0}/{1}", TroubleshooterCommentBaseUrl, troubleshooterCommentId);

            TroubleshooterCommentCollection troubleshooterComments = Connector.ExecuteGet <TroubleshooterCommentCollection>(apiMethod);

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

            return(null);
        }
Exemplo n.º 4
0
        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 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);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public void GetTroubleshooterComment()
        {
            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");

            TroubleshooterComment troubleshooterCommentToGet = troubleshooterComments[new Random().Next(troubleshooterComments.Count)];

            Trace.WriteLine("GetTroubleshooterCategory using troubleshooter comment id: " + troubleshooterCommentToGet.Id);

            TroubleshooterComment troubleshooterComment = TestSetup.KayakoApiService.Troubleshooter.GetTroubleshooterComment(troubleshooterCommentToGet.Id);

            AssertObjectXmlEqual(troubleshooterComment, troubleshooterCommentToGet);
        }
        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()
                };
        }