Example #1
0
        public void Incidents_AddAttachment()
        {
            var anAttachment = new Attachment
            {
                Id = 0
            };

            var parameters = new Dictionary <string, object>
            {
                { "file_name", anAttachment.FileName },
                { "description", anAttachment.Description },
            };

            // Set test Create method w/o parameters
            request.Setup(m => m.Post <Response <Attachment> >("incidents/666/attachments", anAttachment.Data, parameters)).Returns(new Response <Attachment>
            {
                Data = new Attachment
                {
                    Id = 1234
                }
            });

            // Test Get method
            var result = incidentsProxy.AddAttachment(666, anAttachment);

            // Verify test
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsSuccessful);
            Assert.AreEqual(1234, result.Data.Id);
        }