• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ListenerForUnitTests类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: BothModifiedExampleFormTextWorksWithConflict

        public void BothModifiedExampleFormTextWorksWithConflict()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"This is my example", @"It's mine don't touch it.");

            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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.AreEqual(1, listener.Conflicts.Count);
                var warning = listener.Conflicts[0];
                Assert.AreEqual(typeof(XmlTextBothEditedTextConflict), warning.GetType(), warning.ToString());
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example/form");
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:35,代码来源:ExampleSentenceMergingTests.cs


示例2: TestSetup

		public override void TestSetup()
		{
			base.TestSetup();
			Mdc.UpgradeToVersion(MetadataCache.MaximumModelVersion);
			_eventListener = new ListenerForUnitTests();
			FieldWorksTestServices.SetupTempFilesWithName(SharedConstants.DataNotebookFilename, MetadataCache.MaximumModelVersion, out _ourFile, out _commonFile, out _theirFile);
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:7,代码来源:FieldWorksAnthropologyTypeHandlerTests.cs


示例3: BothAddedHeaderButWithDifferentContentInEach

        public void BothAddedHeaderButWithDifferentContentInEach()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='parent' guid='c1ed1fa3-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='a'>
                                    <text>form parent</text>
                                </form>
                            </lexical-unit>
                         </entry>
                    </lift>";
            var alpha = ancestor.Replace("<entry id", "<header><description>alphastuff</description></header><entry id");
            var beta = ancestor.Replace("<entry id", "<header><ranges>betastuff</ranges></header><entry id");

            using (var oursTemp = new TempFile(alpha))
            using (var theirsTemp = new TempFile(beta))
            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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry",
                    "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.IsTrue(result.Contains("<header>"));
                Assert.IsTrue(result.Contains("<description>"));
                Assert.IsTrue(result.Contains("<ranges>"));
                listener.AssertExpectedChangesCount(2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:34,代码来源:FileLevelMergeTests.cs


示例4: OneAddedOneTranslationOtherEditedFormText

        public void OneAddedOneTranslationOtherEditedFormText()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";
            var ours = ancestor.Replace(@"This is my example", @"This was your example");
            var theirs = ancestor.Replace(@"</example>", @"<form lang='en'><text>hello new entry</text></form></example>");

            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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example");
                AssertThatXmlIn.String(result).HasSpecifiedNumberOfMatchesForXpath("//example/form", 2);
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:33,代码来源:ExampleSentenceMergingTests.cs


示例5: AllHadProperty_ButNothingElse

        public void AllHadProperty_ButNothingElse()
        {
            const string commonAncestor =
            @"<Lexicon>
            <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
            <Etymology>
            </Etymology>
            </LexEntry>
            </Lexicon>";

            const string ours =
            @"<Lexicon>
            <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
            <Etymology>
            </Etymology>
            </LexEntry>
            </Lexicon>";

            const string theirs =
            @"<Lexicon>
            <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'>
            <Etymology>
            </Etymology>
            </LexEntry>
            </Lexicon>";

            var listener = new ListenerForUnitTests();
            var merger = new XmlMerger(new NullMergeSituation())
            {
                EventListener = listener
            };
            merger.MergeStrategies.SetStrategy("Lexicon", ElementStrategy.CreateSingletonElement());

            var strat = ElementStrategy.CreateForKeyedElement("guid", false);
            strat.AttributesToIgnoreForMerging.Add("guid");
            merger.MergeStrategies.SetStrategy("LexEntry", strat);

            strat = ElementStrategy.CreateSingletonElement();
            strat.NumberOfChildren = NumberOfChildrenAllowed.ZeroOrOne;
            merger.MergeStrategies.SetStrategy("Etymology", strat);

            strat = ElementStrategy.CreateForKeyedElement("guid", false);
            strat.AttributesToIgnoreForMerging.Add("guid");
            merger.MergeStrategies.SetStrategy("LexEtymology", strat);

            XmlTestHelper.DoMerge(merger.MergeStrategies, merger.MergeSituation,
                                  commonAncestor, ours, theirs,
                                  new[] { "Lexicon/LexEntry/Etymology" },
                                  null,
                                  0, new List<Type>(),
                                  0, new List<Type>());
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:52,代码来源:MergeLimitedChildrenServiceTests.cs


示例6: 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


示例7: BothAdded_ButNotTheSame_HasConflictForTheyWin_TheirChangeIsKept

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


示例8: DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler

        public void DeletionReport_Not_ProducedForDeletedAnnotationUsingNotesHandler()
        {
            const string parent = @"<?xml version='1.0' encoding='utf-8'?>
                    <notes version='0'>
                        <annotation guid='old1'/>
                        <annotation guid='soonToBeGoner'/>
                    </notes>";
            const string child = @"<?xml version='1.0' encoding='utf-8'?>
                    <notes version='0'>
                        <annotation guid='old1'/>
                    </notes>";

            // Make sure the common differ code does produce the deletion report.
            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,
                    "annotation",
                    "guid");
                differ.ReportDifferencesToListener();
                listener.AssertExpectedChangesCount(1);
                listener.AssertFirstChangeType<XmlDeletionChangeReport>();
            }
            // Now make sure the ChorusNotesFileHandler filters it out, and does not return it,
            // as per the original notes differ code.
            var notesHandler = (from handler in ChorusFileTypeHandlerCollection.CreateWithInstalledHandlers().Handlers
                                where handler.GetType().Name == "ChorusNotesFileHandler"
                                select handler).First();
            using (var repositorySetup = new RepositorySetup("randy"))
            {
                repositorySetup.AddAndCheckinFile("notestest.ChorusNotes", parent);
                repositorySetup.ChangeFileAndCommit("notestest.ChorusNotes", child, "change it");
                var hgRepository = repositorySetup.Repository;
                var allRevisions = (from rev in hgRepository.GetAllRevisions()
                                    orderby rev.Number.LocalRevisionNumber
                                    select rev).ToList();
                var first = allRevisions[0];
                var second = allRevisions[1];
                var firstFiR = hgRepository.GetFilesInRevision(first).First();
                var secondFiR = hgRepository.GetFilesInRevision(second).First();
                var result = notesHandler.Find2WayDifferences(firstFiR, secondFiR, hgRepository);
                Assert.AreEqual(0, result.Count());
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:47,代码来源:FileLevelDiffTests.cs


示例9: Conflict_TheirsAppearsInCollisionNote

        public void Conflict_TheirsAppearsInCollisionNote()
        {
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='lexicalformcollission' guid='c1ed1fa7-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='x'>
                                    <text>ours</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='lexicalformcollission' guid='c1ed1fa7-e382-11de-8a39-0800200c9a66' >
                            <lexical-unit>
                                <form lang='x'>
                                    <text>theirs</text>
                                </form>
                            </lexical-unit>
                        </entry>
                    </lift>";
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                    <lift version='0.10' producer='WeSay 1.0.0.0'>
                        <entry id='lexicalformcollission' guid='c1ed1fa7-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 PoorMansMergeStrategy(),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry[@id='lexicalformcollission']");
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry");//just one
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/field[@type='mergeConflict']/trait[@name = 'looserData']");
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/field[@type='mergeConflict' and @dateCreated]");
            }
        }
开发者ID:sillsdev,项目名称:chack,代码行数:46,代码来源:PoorMansMergingStrategyTests.cs


示例10: RangeSectionMergedCorrectly

 public void RangeSectionMergedCorrectly()
 {
     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 LiftEntryMergingStrategy(mergeOrder),
             false,
             "header",
             "entry", "guid");
         var result = File.ReadAllText(mergeOrder.pathToOurs);
         XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry[@id='usOnly']");
         AssertThatXmlIn.String(result).HasSpecifiedNumberOfMatchesForXpath(@"lift/header/ranges/range", 4);
     }
 }
开发者ID:regnrand,项目名称:chorus,代码行数:18,代码来源:LiftHeaderMergingTests.cs


示例11: 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


示例12: 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


示例13: 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


示例14: RunServiceCore

        private static XmlNode RunServiceCore(string common, string ours, string theirs,
			MergeSituation mergeSituation, out XmlNode returnAncestorNode, out ListenerForUnitTests listener)
        {
            XmlNode ourNode;
            XmlNode theirNode;
            XmlNode ancestorNode;
            CreateThreeNodes(ours, out ourNode,
                             theirs, out theirNode,
                             common, out ancestorNode);
            returnAncestorNode = ancestorNode;

            var merger = GetMerger(mergeSituation, out listener);
            Assert.DoesNotThrow(() => MergeAtomicElementService.Run(merger, ref ourNode, theirNode, ancestorNode));

            return ourNode;
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:16,代码来源:MergeAtomicElementServiceTests.cs


示例15: GetMerger

 private static XmlMerger GetMerger(out ListenerForUnitTests listener, bool isAtomic)
 {
     var elementStrategy = new ElementStrategy(false)
         {
             IsAtomic = isAtomic
         };
     var merger = new XmlMerger(new NullMergeSituation());
     merger.MergeStrategies.SetStrategy("topatomic", elementStrategy);
     listener = new ListenerForUnitTests();
     merger.EventListener = listener;
     return merger;
 }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:12,代码来源:MergeAtomicElementServiceTests.cs


示例16: DeleteAtomicElementVsModifyHasConflict

        public void DeleteAtomicElementVsModifyHasConflict()
        {
            const string commonAncestor =
            @"<Lexicon>
            <LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
            <MorphoSyntaxAnalyses>
            <MoStemMsa
                guid='33adabe9-a02e-42cb-b942-277a7be5c841'>
                <PartOfSpeech>
                    <objsur
                        guid='e72dbc59-e93f-4df2-b6bd-39a53e331201'
                        t='r' />
                </PartOfSpeech>
            </MoStemMsa>
            </MorphoSyntaxAnalyses>
            <Senses/>
            </LexEntry>
            </Lexicon>";
            const string matthew =
            @"<Lexicon>
            <LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
            <MorphoSyntaxAnalyses>
            <MoStemMsa
                guid='33adabe9-a02e-42cb-b942-277a7be5c841'>
                <PartOfSpeech>
                    <objsur
                        guid='f92dbc59-e93f-4df2-b6bd-39a53e331201'
                        t='r' />
                </PartOfSpeech>
            </MoStemMsa>
            </MorphoSyntaxAnalyses>
            <Senses/>
            </LexEntry>
            </Lexicon>";
            const string lee =
            @"<Lexicon>
            <LexEntry guid='ffdc58c9-5cc3-469f-9118-9f18c0138d02'>
            <MorphoSyntaxAnalyses>
            <MoStemMsa
                guid='33adabe9-a02e-42cb-b942-277a7be5c841'>
                <PartOfSpeech />
            </MoStemMsa>
            </MorphoSyntaxAnalyses>
            <Senses/>
            </LexEntry>
            </Lexicon>";

            var listener = new ListenerForUnitTests();
            var merger = new XmlMerger(new NullMergeSituation())
            {
                EventListener = listener
            };
            merger.MergeStrategies.SetStrategy("Lexicon", ElementStrategy.CreateSingletonElement());

            var strat = ElementStrategy.CreateForKeyedElement("guid", false);
            strat.AttributesToIgnoreForMerging.Add("guid");
            merger.MergeStrategies.SetStrategy("LexEntry", strat);

            strat = ElementStrategy.CreateSingletonElement();
            strat.NumberOfChildren = NumberOfChildrenAllowed.ZeroOrOne;
            merger.MergeStrategies.SetStrategy("MorphoSyntaxAnalyses", strat);

            strat = ElementStrategy.CreateForKeyedElement("guid", false);
            strat.AttributesToIgnoreForMerging.Add("guid");
            merger.MergeStrategies.SetStrategy("MoStemMsa", strat);

            strat = ElementStrategy.CreateSingletonElement();
            strat.NumberOfChildren = NumberOfChildrenAllowed.ZeroOrOne;
            merger.MergeStrategies.SetStrategy("PartOfSpeech", strat);

            strat = ElementStrategy.CreateSingletonElement();
            strat.IsAtomic = true;
            merger.MergeStrategies.SetStrategy("objsur", strat);

            XmlTestHelper.DoMerge(merger.MergeStrategies,
                merger.MergeSituation,
                commonAncestor, lee, matthew,
                new[] { "Lexicon/LexEntry/MorphoSyntaxAnalyses/MoStemMsa/PartOfSpeech/objsur[@guid='f92dbc59-e93f-4df2-b6bd-39a53e331201']" },
                null,
                1, new List<Type> { typeof(RemovedVsEditedElementConflict) },
                0, new List<Type>());
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:82,代码来源:MergeAtomicElementServiceTests.cs


示例17: DoMerge

		private static void DoMerge(IChorusFileTypeHandler fileHandler, int ours)
		{
			TempFile ourFile;
			TempFile commonFile;
			TempFile theirFile;
			FieldWorksTestServices.SetupTempFilesWithExtension(".ModelVersion", out  ourFile, out commonFile, out theirFile);

			try
			{
				var baseModelVersion = ours - 1;
				File.WriteAllText(commonFile.Path, FormatModelVersionData(baseModelVersion));
				File.WriteAllText(ourFile.Path, FormatModelVersionData(ours));
				File.WriteAllText(theirFile.Path, FormatModelVersionData(baseModelVersion));

				var listener = new ListenerForUnitTests();
				var mergeOrder = new MergeOrder(ourFile.Path, commonFile.Path, theirFile.Path, new NullMergeSituation())
				{
					EventListener = listener
				};
				fileHandler.Do3WayMerge(mergeOrder);
			}
			finally
			{
				FieldWorksTestServices.RemoveTempFiles(ref ourFile, ref commonFile, ref theirFile);
			}
		}
开发者ID:gmartin7,项目名称:flexbridge,代码行数:26,代码来源:UpdateMetaDataCacheTests.cs


示例18: Merge_MultiTextInFormInEntry_ResultHasWarningReport

        public void Merge_MultiTextInFormInEntry_ResultHasWarningReport()
        {
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                <lift version='0.10' producer='WeSay 1.0.0.0'>
                    <entry
                        id='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='en'>
                                <text>common form</text>
                                <text>our extra text</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='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='en'>
                                <text>common form</text>
                                <text>their extra text</text>
                            </form>
                        </lexical-unit>
                    </entry>
                </lift>";

            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                <lift version='0.10' producer='WeSay 1.0.0.0'>
                    <entry
                        id='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='en'>
                                <text>common form</text>
                            </form>
                        </lexical-unit>
                    </entry>
                </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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                // Check that there is only one entry in the merged file.
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/lexical-unit/form/text");
                XmlTestHelper.AssertXPathIsNull(result, "lift/entry/lexical-unit/form/text[text()='extra text']");
                Assert.AreEqual(2, listener.Warnings.Count);
                Assert.AreEqual(typeof(MergeWarning), listener.Warnings[0].GetType());
                Assert.AreEqual(typeof(MergeWarning), listener.Warnings[1].GetType());
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:66,代码来源:LexEntryMergingTests.cs


示例19: Merge_AncestorAndOursSame_ResultHasTheirsAlso

        public void Merge_AncestorAndOursSame_ResultHasTheirsAlso()
        {
            const string ours = @"<?xml version='1.0' encoding='utf-8'?>
                <lift version='0.10' producer='WeSay 1.0.0.0'>
                    <entry
                        dateCreated='2011-03-09T17:08:44Z'
                        dateModified='2012-05-18T08:31:54Z'
                        id='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='ldb-fonipa-x-emic'>
                                <text>asatɛn</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='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        dateCreated='2011-03-09T05:08:44Z'
                        dateModified='2012-05-14T02:38:00Z'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='ldb-fonipa-x-emic'>
                                <text>asatɛn</text>
                            </form>
                            <form
                                lang='ldb-Zxxx-x-audio'>
                                <text>asatɛn-63472603074018.wav</text>
                            </form>
                        </lexical-unit>
                    </entry>
                </lift>";

            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
                <lift version='0.10' producer='WeSay 1.0.0.0'>
                    <entry
                        dateCreated='2011-03-09T17:08:44Z'
                        dateModified='2011-04-08T16:53:45Z'
                        id='00853b73-fda2-4b12-8a89-6957cc7e7e79'
                        guid='00853b73-fda2-4b12-8a89-6957cc7e7e79'>
                        <lexical-unit>
                            <form
                                lang='ldb-fonipa-x-emic'>
                                <text>asatɛn</text>
                            </form>
                        </lexical-unit>

                    </entry>
                </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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                //this doesn't seem particular relevant, but senses are, in fact, ordered, so there is some ambiguity here
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                //Assert.AreEqual(typeof(AmbiguousInsertConflict), listener.Conflicts[0].GetType());
                // Check that the audio made it into the merge.
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/lexical-unit/form[@lang='ldb-fonipa-x-emic']");
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/lexical-unit/form[@lang='ldb-Zxxx-x-audio']");
            }
        }
开发者ID:regnrand,项目名称:chorus,代码行数:75,代码来源:LexEntryMergingTests.cs


示例20: OneEditedExampleWhileOtherAddedTranslation_MergesButRaiseWarning

        public void OneEditedExampleWhileOtherAddedTranslation_MergesButRaiseWarning()
        {
            const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
            <lift version='0.10' producer='WeSay 1.0.0.0'>
            <entry id='test'  guid='F169EB3D-16F2-4eb0-91AA-FDB91636F8F6'>
            <sense id='123'>
             <example>
            <form lang='chorus'>
              <text>This is my example sentence.</text>
            </form>
              </example>
            </sense>
            </entry>
            </lift>";

            var ours = ancestor.Replace("This is my", "This is our");
            var theirs = ancestor.Replace("</example>","<translation><form lang='en'><text>hello</text></form></translation></example>");

            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 LiftEntryMergingStrategy(mergeOrder),
                    false,
                    "header",
                    "entry", "guid");
                var result = File.ReadAllText(mergeOrder.pathToOurs);
                Assert.AreEqual(1, listener.Conflicts.Count);
                var warning = listener.Warnings[0];
                Assert.AreEqual(typeof(BothEditedDifferentPartsOfDependentPiecesOfDataWarning), warning.GetType(), warning.ToString());
                XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example");
            }
        }
开发者ID:JessieGriffin,项目名称:chorus,代码行数:37,代码来源:ExampleSentenceMergingTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Literal类代码示例发布时间:2022-05-24
下一篇:
C# Listener类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap