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


C# ListenerForUnitTests.AssertExpectedConflictCount方法代码示例

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


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

示例1: AncestorNull_OursNull_TheirsNotNull_HasChangeReport_AndTheirsIsKeptInMerge

 public void AncestorNull_OursNull_TheirsNotNull_HasChangeReport_AndTheirsIsKeptInMerge()
 {
     var listener = new ListenerForUnitTests();
     XmlNode ours;
     XmlNode theirs;
     var resultNode = DoMerge(null, null, "<NewImmutableElemment />", new NullMergeSituation(), listener, out ours, out theirs);
     Assert.IsNotNull(resultNode);
     Assert.AreEqual("<NewImmutableElemment />", resultNode.OuterXml);
     listener.AssertExpectedChangesCount(1);
     listener.AssertFirstChangeType<XmlAdditionChangeReport>();
     listener.AssertExpectedConflictCount(0);
     Assert.AreSame(ours, theirs);
     Assert.AreSame(ours, resultNode);
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:14,代码来源:ImmutableElementMergeServiceTests.cs

示例2: BothDidSameUpgrade

        public void BothDidSameUpgrade()
        {
            const string commonData = "{\"modelversion\": 7000044}";
            const string ourData = "{\"modelversion\": 7000046}";
            const string theirData = "{\"modelversion\": 7000046}";

            File.WriteAllText(_commonFile.Path, commonData);
            File.WriteAllText(_ourFile.Path, ourData);
            File.WriteAllText(_theirFile.Path, theirData);

            var listener = new ListenerForUnitTests();
            var mergeOrder = new MergeOrder(_ourFile.Path, _commonFile.Path, _ourFile.Path, new NullMergeSituation()) { EventListener = listener };
            FileHandler.Do3WayMerge(mergeOrder);
            var mergedData = File.ReadAllText(_ourFile.Path);
            Assert.AreEqual(ourData, mergedData);
            listener.AssertExpectedConflictCount(0);
            listener.AssertExpectedChangesCount(1);
            listener.AssertFirstChangeType<FieldWorksModelVersionUpdatedReport>();
        }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:19,代码来源:FieldWorksModelVersionFileHandlerTests.cs

示例3: GuidAttrBeforeIdAttrDoesNotGenerateReports

 public void GuidAttrBeforeIdAttrDoesNotGenerateReports()
 {
     const string parent = @"<?xml version='1.0' encoding='utf-8'?>
             <root>
                 <item id='fuzz-old1' guid='old1'/>
             </root>";
     const string child = @"<?xml version='1.0' encoding='utf-8'?>
             <root>
                 <item guid='old1' id='fuzz-old1'/>
             </root>";
     using (var parentTempFile = new TempFile(parent))
     using (var childTempFile = new TempFile(child))
     {
         var listener = new ListenerForUnitTests();
         var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path, listener,
             null, "item", "id");
         differ.ReportDifferencesToListener();
         listener.AssertExpectedChangesCount(0);
         listener.AssertExpectedConflictCount(0);
     }
 }
开发者ID:sillsdev,项目名称:chack,代码行数:21,代码来源:Xml2WayDifferTests.cs

示例4: Deletion_WasTombstoneNowMissing_NoDeletionReport

 public void Deletion_WasTombstoneNowMissing_NoDeletionReport()
 {
     const string parent = @"<?xml version='1.0' encoding='utf-8'?>
             <lift version='0.10' producer='WeSay 1.0.0.0'>
                 <item id='old1' dateDeleted='2009-06-16T06:14:20Z'/>
                 <item id='old2'/>
             </lift>";
     const string child = @"<?xml version='1.0' encoding='utf-8'?>
             <lift version='0.10' producer='WeSay 1.0.0.0'>
                 <item id='old2'/>
             </lift>";
     using (var parentTempFile = new TempFile(parent))
     using (var childTempFile = new TempFile(child))
     {
         var listener = new ListenerForUnitTests();
         var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path, listener,
             null, "item", "id");
         differ.ReportDifferencesToListener();
         listener.AssertExpectedChangesCount(0);
         listener.AssertExpectedConflictCount(0);
     }
 }
开发者ID:sillsdev,项目名称:chack,代码行数:22,代码来源:Xml2WayDifferTests.cs

示例5: NewStyle_DoomedByUsEditedByThem_HasOneConflict

        public void NewStyle_DoomedByUsEditedByThem_HasOneConflict()
        {
            // New Style means the deleted entry was really removed from the file, not just marked as deleted.
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1f9b-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                        <entry id='doomedByUsEditedByThem' guid='c1ed1f9c-e382-11de-8a39-0800200c9a66' >
                            <sense>
                                 <gloss lang='a'>
                                    <text>original</text>
                                 </gloss>
                            </sense>
                        </entry>
                    </lift>";
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1f9b-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                    </lift>";

            const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1f9b-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                        <entry id='doomedByUsEditedByThem' guid='c1ed1f9c-e382-11de-8a39-0800200c9a66' >
                            <sense>
                                 <gloss lang='a'>
                                    <text>newByThem</text>
                                 </gloss>
                            </sense>
                        </entry>

                    </lift>";

            var listener = new ListenerForUnitTests();
            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new DropTheirsMergeStrategy(),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.IsTrue(result.ToLower().Contains("utf-8"));
            }
            listener.AssertExpectedChangesCount(0);
            listener.AssertExpectedConflictCount(1);
            listener.AssertFirstConflictType<RemovedVsEditedElementConflict>();
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:68,代码来源:FileLevelMergeTests.cs

示例6: Merge_RealConflictPlusModDateConflict_ModDateNotReportedAsConflict

        public void Merge_RealConflictPlusModDateConflict_ModDateNotReportedAsConflict()
        {
            const string template = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='blah' guid='c1ed1f94-e382-11de-8a39-0800200c9a66' dateModified='theDate'>
                           <lexical-unit>
                                <form lang='a'>
                                    <text>theForm</text>
                                </form>
                            </lexical-unit>
                        </entry>
                    </lift>";

            // NB: dateModified is set to ignore for LiftEntryMergingStrategy, thus no conflict report.
            using (var oursTemp = new TempFile(template.Replace("theDate",		"2009-07-08T01:47:06Z").Replace("theForm", "1")))
            using (var theirsTemp = new TempFile(template.Replace("theDate",	"2009-07-09T01:47:05Z").Replace("theForm", "2")))
            using (var ancestorTemp = new TempFile(template.Replace("theDate",	"2009-07-09T01:47:04Z").Replace("theForm", "3")))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                listener.AssertExpectedConflictCount(1);
                listener.AssertFirstConflictType<XmlTextBothEditedTextConflict>();
                listener.AssertExpectedChangesCount(0);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:30,代码来源:FileLevelMergeTests.cs

示例7: NewEntryFromUs_HasNoChangeReports

        public void NewEntryFromUs_HasNoChangeReports()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='commonOldie' guid='c1ecf897-e382-11de-8a39-0800200c9a66' />
                    </lift>";
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='ourNew' guid='c1ecf898-e382-11de-8a39-0800200c9a66' />
                        <entry id='commonOldie' guid='c1ecf897-e382-11de-8a39-0800200c9a66' />
                    </lift>";
            const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='commonOldie' guid='c1ecf897-e382-11de-8a39-0800200c9a66' />
                    </lift>";

            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var listener = new ListenerForUnitTests();
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new DropTheirsMergeStrategy(),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry[@id='ourNew']");
                listener.AssertExpectedConflictCount(0);
                listener.AssertExpectedChangesCount(0);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:33,代码来源:FileLevelMergeTests.cs

示例8: DoomedByUs_OldWay_AndByThem_NewWay_HasNoChangeReports

        public void DoomedByUs_OldWay_AndByThem_NewWay_HasNoChangeReports()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1fa1-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                        <entry id='doomedByBoth' guid='c1ed1fa2-e382-11de-8a39-0800200c9a66' >
                            <sense>
                                 <gloss lang='a'>
                                    <text>original</text>
                                 </gloss>
                            </sense>
                        </entry>
                    </lift>";
            // 'ours' does the older dateDeleted marking.
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1fa1-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                        <entry id='doomedByBoth' guid='c1ed1fa2-e382-11de-8a39-0800200c9a66'  dateDeleted='2011-03-15T12:15:05Z' />
                    </lift>";
            // 'theirs' does the newer removal.
            const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='noChangesInEither' guid='c1ed1fa1-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form a</text>
                                </form>
                            </lexical-unit>
                         </entry>
                    </lift>";

            var listener = new ListenerForUnitTests();
            using (var oursTemp = new TempFile(ours))
            using (var theirsTemp = new TempFile(theirs))
            using (var ancestorTemp = new TempFile(ancestor))
            {
                var situation = new NullMergeSituation();
                var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
                XmlMergeService.Do3WayMerge(mergeOrder, new DropTheirsMergeStrategy(),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.IsTrue(result.ToLower().Contains("utf-8"));
            }
            listener.AssertExpectedConflictCount(0);
            listener.AssertExpectedChangesCount(0);
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:60,代码来源:FileLevelMergeTests.cs

示例9: Empty_Ancestor_Adds_Children_From_Both

 public void Empty_Ancestor_Adds_Children_From_Both()
 {
     const string ours = @"<?xml version='1.0' encoding='utf-8'?>
             <lift version='0.10' producer='WeSay 1.0.0.0'>
                 <entry id='usOnly' guid='c1ed1f95-e382-11de-8a39-0800200c9a66' />
             </lift>";
     const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
             <lift version='0.10' producer='WeSay 1.0.0.0'>
                 <entry id='themOnly' guid='c1ed1f96-e382-11de-8a39-0800200c9a66' />
             </lift>";
     const string ancestor = @"<lift version='0.12'></lift>";
     using (var oursTemp = new TempFile(ours))
     using (var theirsTemp = new TempFile(theirs))
     using (var ancestorTemp = new TempFile(ancestor))
     {
         var listener = new ListenerForUnitTests();
         var situation = new NullMergeSituation();
         var mergeOrder = new MergeOrder(oursTemp.Path, ancestorTemp.Path, theirsTemp.Path, situation) { EventListener = listener };
         XmlMergeService.Do3WayMerge(mergeOrder, new PoorMansMergeStrategy(),
             false,
             "header",
             "entry", "guid");
         var result = File.ReadAllText(mergeOrder.pathToOurs);
         // REVIEW JohnT(RandyR): Should new entries from 'loser' register an addition change?
         XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift[entry/@id='usOnly']");
         XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift[entry/@id='themOnly']");
         listener.AssertExpectedChangesCount(0);
         listener.AssertExpectedConflictCount(0);
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:30,代码来源:FileLevelMergeTests.cs

示例10: CheckMergeResults

        public static void CheckMergeResults(string mergedResults, ListenerForUnitTests eventListener,
			IEnumerable<string> xpathQueriesThatMatchExactlyOneNode, IEnumerable<string> xpathQueriesThatReturnNull,
			int expectedConflictCount, List<Type> expectedConflictTypes,
			int expectedChangesCount, List<Type> expectedChangeTypes)
        {
            if (xpathQueriesThatMatchExactlyOneNode != null)
            {
                foreach (var query in xpathQueriesThatMatchExactlyOneNode)
                    AssertXPathMatchesExactlyOne(mergedResults, query);
            }

            if (xpathQueriesThatReturnNull != null)
            {
                foreach (var query in xpathQueriesThatReturnNull)
                    AssertXPathIsNull(mergedResults, query);
            }

            eventListener.AssertExpectedConflictCount(expectedConflictCount);
            expectedConflictTypes = expectedConflictTypes ?? new List<Type>();
            Assert.AreEqual(expectedConflictTypes.Count, eventListener.Conflicts.Count,
                            "Expected conflict count and actual number found differ.");
            for (var idx = 0; idx < expectedConflictTypes.Count; ++idx)
                Assert.AreSame(expectedConflictTypes[idx], eventListener.Conflicts[idx].GetType());

            eventListener.AssertExpectedChangesCount(expectedChangesCount);
            expectedChangeTypes = expectedChangeTypes ?? new List<Type>();
            Assert.AreEqual(expectedChangeTypes.Count, eventListener.Changes.Count,
                            "Expected change count and actual number found differ.");
            for (var idx = 0; idx < expectedChangeTypes.Count; ++idx)
                Assert.AreSame(expectedChangeTypes[idx], eventListener.Changes[idx].GetType());
        }
开发者ID:sillsdev,项目名称:chack,代码行数:31,代码来源:XmlTestHelper.cs

示例11: XmlMergerCallsImmutableElementMergeServiceForImmutableElement

 public void XmlMergerCallsImmutableElementMergeServiceForImmutableElement()
 {
     var listener = new ListenerForUnitTests();
     var merger = new XmlMerger(new NullMergeSituation())
     {
         EventListener = listener
     };
     var elemStrat = new ElementStrategy(false)
         {
             IsImmutable = true
         };
     merger.MergeStrategies.SetStrategy("ImmutableElemment", elemStrat);
     var ancestor = CreateNode("<ImmutableElemment attr='originalvalue' />");
     var ours = CreateNode("<ImmutableElemment attr='ourvalue' />");
     var theirs = CreateNode("<ImmutableElemment attr='theirvalue' />");
     merger.MergeInner(ref ours, theirs, ancestor);
     Assert.AreSame(ancestor, ours);
     Assert.AreEqual("<ImmutableElemment attr=\"originalvalue\" />", ancestor.OuterXml);
     listener.AssertExpectedChangesCount(0);
     listener.AssertExpectedConflictCount(0);
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:21,代码来源:ImmutableElementMergeServiceTests.cs

示例12: SimpleChangeGeneratesReport

 public void SimpleChangeGeneratesReport()
 {
     const string parent = @"<?xml version='1.0' encoding='utf-8'?>
             <root>
                 <item id='old1'/>
             </root>";
     const string child = @"<?xml version='1.0' encoding='utf-8'?>
             <root>
                 <item id='old1' newAttr='newValue' />
             </root>";
     using (var parentTempFile = new TempFile(parent))
     using (var childTempFile = new TempFile(child))
     {
         var listener = new ListenerForUnitTests();
         var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path, listener,
             null, "item", "id");
         differ.ReportDifferencesToListener();
         listener.AssertExpectedChangesCount(1);
         listener.AssertFirstChangeType<XmlChangedRecordReport>();
         listener.AssertExpectedConflictCount(0);
     }
 }
开发者ID:sillsdev,项目名称:chack,代码行数:22,代码来源:Xml2WayDifferTests.cs

示例13: AncestorIsEmptyFileAndBothAddedSameThingHasOneChangeReport

 public void AncestorIsEmptyFileAndBothAddedSameThingHasOneChangeReport()
 {
     const string data =
     @"<?xml version='1.0' encoding='utf-8'?>
     <data />";
     using (var ancestor = new TempFile())
     using (var ours = new TempFile())
     using (var theirs = new TempFile())
     {
         File.WriteAllText(ancestor.Path, "");
         File.WriteAllText(ours.Path, data);
         File.WriteAllText(theirs.Path, data);
         var listener = new ListenerForUnitTests();
         var merger = new XmlMerger(new NullMergeSituation())
             {
                 EventListener = listener
             };
         var result = merger.MergeFiles(ours.Path, theirs.Path, ancestor.Path);
         Assert.IsNotNull(result);
         listener.AssertExpectedChangesCount(1);
         listener.AssertFirstChangeType<XmlBothAddedSameChangeReport>();
         listener.AssertExpectedConflictCount(0);
     }
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:24,代码来源:XmlMergerTests.cs

示例14: NoChangesReported

		public void NoChangesReported()
		{
			const string parent =
@"<?xml version='1.0' encoding='utf-8'?>
<AdditionalFields>
<CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' />
</AdditionalFields>";
			// One deletion, one change, and one insertion, and one unchanged.
			const string child =
@"<?xml version='1.0' encoding='utf-8'?>
<AdditionalFields>
<CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' />
</AdditionalFields>";
			using (var parentTempFile = new TempFile(parent))
			using (var childTempFile = new TempFile(child))
			{
				var listener = new ListenerForUnitTests();
				var differ = Xml2WayDiffer.CreateFromFiles(parentTempFile.Path, childTempFile.Path, listener,
					null,
					"CustomField",
					"key");
				differ.ReportDifferencesToListener();
				listener.AssertExpectedConflictCount(0);
				listener.AssertExpectedChangesCount(0);
			}
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:26,代码来源:FieldWorksCustomPropertyFileHandlerTests.cs

示例15: MultiStrCustomPropertyMergesRight

		public void MultiStrCustomPropertyMergesRight()
		{
			const string commonAncestor =
@"<?xml version='1.0' encoding='utf-8'?>
<Root>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='qaa-x-ezpi'>
						<Run
							ws='qaa-x-ezpi'>saklo, yzaklo, rzaklo, wzaklo, nzaklo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Root>";
			const string sue =
@"<?xml version='1.0' encoding='utf-8'?>
<Root>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='qaa-x-ezpi'>
						<Run
							ws='qaa-x-ezpi'>saglo, yzaglo, rzaglo, wzaglo, nzaglo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Root>";
			const string randy =
@"<?xml version='1.0' encoding='utf-8'?>
<Root>
	<LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
		<Senses>
			<ownseq class='LexSense' guid='97129e67-e0a5-47c4-a875-05c2b2e1b7df'>
				<Custom
					name='Paradigm'>
					<AStr
						ws='zpi'>
						<Run
							ws='zpi'>saklo, yzaklo, rzaklo, wzaklo, nzaklo, -</Run>
					</AStr>
				</Custom>
			</ownseq>
		</Senses>
	</LexEntry>
</Root>";

			File.WriteAllText(_ourFile.Path, randy);
			File.WriteAllText(_theirFile.Path, sue);
			File.WriteAllText(_commonFile.Path, commonAncestor);
			var mdc = MetadataCache.TestOnlyNewCache;
			mdc.AddCustomPropInfo("LexSense", new FdoPropertyInfo("Paradigm", DataType.MultiString, true));
			mdc.ResetCaches();
			var eventListener = new ListenerForUnitTests();
			var mergeOrder = new MergeOrder(_ourFile.Path, _commonFile.Path, _theirFile.Path, new NullMergeSituation())
			{
				EventListener = eventListener
			};
			var handlerStrat = new CustomPropertiesTypeHandlerStrategy();
			handlerStrat.Do3WayMerge(mdc, mergeOrder);

			var doc = XDocument.Load(_ourFile.Path);
			var entryElement = doc.Root.Element("LexEntry");
			var ownseqElement = entryElement.Element("Senses").Element(SharedConstants.Ownseq);
			Assert.IsTrue(ownseqElement.Elements(SharedConstants.Custom).Count() == 1);
			var aStrNodes = ownseqElement.Element(SharedConstants.Custom).Elements("AStr").ToList();
			Assert.IsTrue(aStrNodes.Count == 2);
			var aStrNode = aStrNodes.ElementAt(0);
			Assert.IsTrue(aStrNode.Attribute("ws").Value == "qaa-x-ezpi");
			Assert.AreEqual("saglo, yzaglo, rzaglo, wzaglo, nzaglo, -", aStrNode.Element("Run").Value);
			aStrNode = aStrNodes.ElementAt(1);
			Assert.IsTrue(aStrNode.Attribute("ws").Value == "zpi");
			Assert.AreEqual("saklo, yzaklo, rzaklo, wzaklo, nzaklo, -", aStrNode.Element("Run").Value);

			eventListener.AssertExpectedConflictCount(1);
			eventListener.AssertFirstConflictType<RemovedVsEditedElementConflict>();
			eventListener.AssertExpectedChangesCount(1);
			eventListener.AssertFirstChangeType<XmlAdditionChangeReport>();
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:89,代码来源:FieldWorksCustomPropertyFileHandlerTests.cs


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