Ejemplo n.º 1
0
        protected Dictionary <string, string> ApplyAttachmentChanges(EntitySyncItem item)
        {
            Event @event = item.Item as Event;
            Dictionary <string, string> dictionary = null;

            if (@event.Attachments != null && @event.Attachments.Count > 0)
            {
                dictionary     = new Dictionary <string, string>(@event.Attachments.Count);
                @event.IsDraft = true;
                List <IAttachment> attachments = @event.Attachments;
                @event.Attachments = null;
                IAttachments attachments2 = this.Events[@event.Id].Attachments;
                foreach (IAttachment attachment in attachments)
                {
                    if (attachment is EntityDeleteAttachment)
                    {
                        attachments2.Delete(attachment.Id, null);
                    }
                    else
                    {
                        string id = attachment.Id;
                        attachment.Id = null;
                        string id2 = attachments2.Create(attachment, null).Id;
                        dictionary[id] = HttpUtility.UrlEncode(item.Item.Id + ":" + id2);
                    }
                }
                @event.IsDraft   = false;
                @event.ChangeKey = null;
            }
            return(dictionary);
        }
Ejemplo n.º 2
0
        public void Attachments_Delete()
        {
            // Set test Create method w/o parameters
            request.Setup(m => m.Delete("attachments", 1234, null)).Returns(true);

            // Test Get method
            var result = attachmentsProxy.Delete(1234);

            // Verify test
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsSuccessful);
            Assert.IsTrue(result.Data);
        }