public void TestReplace() { XElement nav = XElement.Load(CaseFile("Replace.xml")); SyncMLReplace f = SyncMLReplace.Create(nav); Assert.IsTrue(CompareXml(nav, f.Xml), f.Xml.ToString()); }
/// <summary> /// Add replace commands from SifCChangeLog /// </summary> /// <param name="commands"></param> private void AddReplaceCommandsToCollection(IList <SyncMLCommand> commands) { IEnumerable <XElement> replaceNodes = XmlHelpers.SafeElementsQuery(sifcChangeLogXml, "Changes", "Update", "C"); foreach (XElement node in replaceNodes) { SyncMLReplace replaceCommand = SyncMLReplace.Create(); AddContentToCommand(replaceCommand, node); commands.Add(replaceCommand); } }
private void PrepareCommands(IList <SyncMLCommand> commands) { IEnumerable <T> newContacts = outlookItems.GetNewItems(AnchorTime); if (forSlowSync) { foreach (T contact in newContacts) { SyncMLReplace updateCommand = SyncMLReplace.Create(); AddContentToCommand(updateCommand, contact); commands.Add(updateCommand); } } else { foreach (T contact in newContacts) { SyncMLAdd addCommand = SyncMLAdd.Create(); AddContentToCommand(addCommand, contact); commands.Add(addCommand); } } IEnumerable <T> updatedContacts = outlookItems.GetUpdatedItems(AnchorTime); foreach (T contact in updatedContacts) { SyncMLReplace updateCommand = SyncMLReplace.Create(); AddContentToCommand(updateCommand, contact); commands.Add(updateCommand); } string[] ids = deletionLog.ReadAll(); if (ids != null) { foreach (string id in ids) { SyncMLDelete deleteCommand = SyncMLDelete.Create(); SyncMLItem item = SyncMLItem.Create(); item.Source.LocURI.Content = id; deleteCommand.ItemCollection.Add(item); commands.Add(deleteCommand); } } }
/// <summary> /// Add AddCommands from SifcChangeLogXML /// </summary> /// <param name="commands">The collections will be expanded, as result.</param> private void AddAddCommandsToCollection(IList <SyncMLCommand> commands) { IEnumerable <XElement> addNodes = XmlHelpers.SafeElementsQuery(sifcChangeLogXml, "Changes", "New", "C"); if (forSlowSync) { foreach (XElement node in addNodes) { SyncMLReplace replaceCommand = SyncMLReplace.Create(); AddContentToCommand(replaceCommand, node); commands.Add(replaceCommand); } } else { foreach (XElement node in addNodes) { SyncMLAdd addCommand = SyncMLAdd.Create(); AddContentToCommand(addCommand, node); commands.Add(addCommand); } } }