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 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 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()
            };
        }
Esempio n. 4
0
        public TroubleshooterAttachment CreateTroubleshooterAttachment(TroubleshooterAttachmentRequest troubleshooterAttachmentRequest)
        {
            RequestBodyBuilder parameters = PopulateRequestParameters(troubleshooterAttachmentRequest, RequestTypes.Create);

            TroubleshooterAttachmentCollection troubleshooterAttachments = Connector.ExecutePost <TroubleshooterAttachmentCollection>(TroubleshooterAttachmentBaseUrl, parameters.ToString());

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

            return(null);
        }
Esempio n. 5
0
        public TroubleshooterAttachment GetTroubleshooterAttachment(int troubleshooterStepId, int troubleshooterAttachmentId)
        {
            string apiMethod = String.Format("{0}/{1}/{2}", TroubleshooterAttachmentBaseUrl, troubleshooterStepId, troubleshooterAttachmentId);

            TroubleshooterAttachmentCollection troubleshooterAttachments = Connector.ExecuteGet <TroubleshooterAttachmentCollection>(apiMethod);

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

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