当前位置: 首页>>代码示例>>C#>>正文


C# XmlMerger.Merge方法代码示例

本文整理汇总了C#中Chorus.merge.xml.generic.XmlMerger.Merge方法的典型用法代码示例。如果您正苦于以下问题:C# XmlMerger.Merge方法的具体用法?C# XmlMerger.Merge怎么用?C# XmlMerger.Merge使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Chorus.merge.xml.generic.XmlMerger的用法示例。


在下文中一共展示了XmlMerger.Merge方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoMerge

 internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
 {
     XmlNode ours;
     XmlNode theirs;
     XmlNode common;
     DoPreMerge(mergeOrder, out ours, out theirs, out common);
     var results = merger.Merge(ours, theirs, common);
     DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:9,代码来源:CustomLayoutMergeService.cs

示例2: DoMerge

		internal static void DoMerge(MergeOrder mergeOrder, XmlMerger merger)
		{
			XmlNode ours;
			XmlNode theirs;
			XmlNode common;
			DoPreMerge(mergeOrder, out ours, out theirs, out common);
			// The document element is being returned here, so our parent isn't relevant and won't be used by the merge
			var results = merger.Merge(null, ours, theirs, common);
			DoPostMerge(mergeOrder.pathToOurs, results.MergedNode);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:10,代码来源:CustomLayoutMergeService.cs

示例3: CheckOneWay

 private ChangeAndConflictAccumulator CheckOneWay(string ours, string theirs, string ancestor, params string[] xpaths)
 {
     XmlMerger m = new XmlMerger(new NullMergeSituation());
     m.MergeStrategies.ElementStrategies.Add("a", ElementStrategy.CreateForKeyedElementInList("key"));
     m.MergeStrategies.ElementStrategies.Add("b", ElementStrategy.CreateForKeyedElementInList("key"));
     m.MergeStrategies.ElementStrategies.Add("c", ElementStrategy.CreateForKeyedElementInList("key"));
     m.MergeStrategies.ElementStrategies.Add("d", ElementStrategy.CreateForKeyedElementInList("key"));
     var result = m.Merge(ours, theirs, ancestor);
     foreach (string xpath in xpaths)
     {
         XmlTestHelper.AssertXPathMatchesExactlyOne(result.MergedNode, xpath);
     }
     return result;
 }
开发者ID:sillsdev,项目名称:chack,代码行数:14,代码来源:XmlListMergerTests.cs

示例4: MergeChildren_UsesNodeToGenerateContextDescriptorIfPossible

        public void MergeChildren_UsesNodeToGenerateContextDescriptorIfPossible()
        {
            string ancestor = @"<a>
                                <b key='one'>
                                    <c key='a'>first</c>
                               </b>
                            </a>";

            string red = ancestor;

            string blue = @"<a>
                                <b key='one'>
                                    <c key='a'>first</c>
                                    <c key='b'>second</c>
                                </b>
                            </a>";
            XmlMerger m = new XmlMerger(new NullMergeSituation());
            m.MergeStrategies.ElementStrategies.Add("a", ElementStrategy.CreateForKeyedElementInList("key"));
            var strategy = ElementStrategy.CreateForKeyedElementInList("key");
            var contextGenerator = new MockContextGenerator();
            strategy.ContextDescriptorGenerator = contextGenerator;
            m.MergeStrategies.ElementStrategies.Add("b", strategy);
            m.MergeStrategies.ElementStrategies.Add("c", ElementStrategy.CreateForKeyedElementInList("key"));
            m.MergeStrategies.ElementStrategies.Add("d", ElementStrategy.CreateForKeyedElementInList("key"));
            m.Merge(red, blue, ancestor);
            Assert.That(contextGenerator.InputNode, Is.Not.Null);
            Assert.That(contextGenerator.InputNode.Name, Is.EqualTo("b"));
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:28,代码来源:XmlMergerTests.cs

示例5: CheckOneWay

        private ChangeAndConflictAccumulator CheckOneWay(string ours, string theirs, string ancestor, MergeSituation situation,
			Dictionary<string, ElementStrategy> specialMergeStrategies,
			Action<string, ElementStrategy> adjustStrategy,
			params string[] xpaths)
        {
            var m = new XmlMerger(situation);
            AddMergeStrategies(m);
            if (specialMergeStrategies != null)
            {
                foreach (var kvp in specialMergeStrategies)
                    m.MergeStrategies.ElementStrategies[kvp.Key] = kvp.Value; // don't use add, some may replace standard ones.
            }
            if (adjustStrategy != null)
            {
                foreach (var kvp in m.MergeStrategies.ElementStrategies)
                    adjustStrategy(kvp.Key, kvp.Value);
            }

            var result = m.Merge(ours, theirs, ancestor);
            foreach (string xpath in xpaths)
            {
                XmlTestHelper.AssertXPathMatchesExactlyOne(result.MergedNode, xpath);
            }
            return result;
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:25,代码来源:XmlMergerTests.cs

示例6: TextElement_WeEditedTheyDeleted_OursKept_ConflictRegistered

        public void TextElement_WeEditedTheyDeleted_OursKept_ConflictRegistered()
        {
            string ancestor = @"<t>original</t>";
            string ours = @"<t>mine</t>";
            string theirs = @"<t></t>";

            XmlMerger m = new XmlMerger(new NullMergeSituation());
            var result = m.Merge(ours, theirs, ancestor);
            XmlTestHelper.AssertXPathMatchesExactlyOne(result.MergedNode, "t[text()='mine']");

            Assert.AreEqual(typeof(XmlTextEditVsRemovedConflict), result.Conflicts[0].GetType());
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:12,代码来源:XmlMergerTests.cs

示例7: TextElement_EachEdited_OursKept_ConflictRegistered

        public void TextElement_EachEdited_OursKept_ConflictRegistered()
        {
            string ancestor = @"<t>original</t>";
            string ours = @"<t>mine</t>";
            string theirs = @"<t>theirs</t>";

            XmlMerger m = new XmlMerger(new MergeSituation("pretendPath", "userX", "XRev","userY", "YRev", MergeOrder.ConflictHandlingModeChoices.WeWin));
            var result = m.Merge(ours, theirs, ancestor);
            XmlTestHelper.AssertXPathMatchesExactlyOne(result.MergedNode, "t[text()='mine']");
            Assert.AreEqual("pretendPath", result.Conflicts[0].RelativeFilePath);

            Assert.AreEqual(typeof(XmlTextBothEditedTextConflict), result.Conflicts[0].GetType());
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:13,代码来源:XmlMergerTests.cs

示例8: DoMerge

        public static string DoMerge(
			MergeStrategies mergeStrategies,
			MergeSituation mergeSituation,
			string ancestorXml, string ourXml, string theirXml,
			IEnumerable<string> xpathQueriesThatMatchExactlyOneNode, IEnumerable<string> xpathQueriesThatReturnNull,
			int expectedConflictCount, List<Type> expectedConflictTypes,
			int expectedChangesCount, List<Type> expectedChangeTypes)
        {
            var doc = new XmlDocument();
            var ourNode = XmlUtilities.GetDocumentNodeFromRawXml(ourXml, doc);
            var theirNode = XmlUtilities.GetDocumentNodeFromRawXml(theirXml, doc);
            var ancestorNode = XmlUtilities.GetDocumentNodeFromRawXml(ancestorXml, doc);

            var eventListener = new ListenerForUnitTests();
            var merger = new XmlMerger(mergeSituation)
                         	{
                                MergeStrategies = mergeStrategies
                         	};
            var retval = merger.Merge(eventListener, ourNode, theirNode, ancestorNode).OuterXml;
            Assert.AreSame(eventListener, merger.EventListener); // Make sure it never changes it, while we aren't looking, since at least one Merge method does that very thing.

            CheckMergeResults(retval, eventListener,
                xpathQueriesThatMatchExactlyOneNode, xpathQueriesThatReturnNull,
                expectedConflictCount, expectedConflictTypes,
                expectedChangesCount, expectedChangeTypes);

            return retval;
        }
开发者ID:sillsdev,项目名称:chack,代码行数:28,代码来源:XmlTestHelper.cs


注:本文中的Chorus.merge.xml.generic.XmlMerger.Merge方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。