本文整理汇总了C#中Chorus.merge.NullMergeSituation类的典型用法代码示例。如果您正苦于以下问题:C# NullMergeSituation类的具体用法?C# NullMergeSituation怎么用?C# NullMergeSituation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NullMergeSituation类属于Chorus.merge命名空间,在下文中一共展示了NullMergeSituation类的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: 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
示例3: 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
示例4: 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
示例5: BothAddedMainItemButWithDifferentContentHasOneConflictReport
public void BothAddedMainItemButWithDifferentContentHasOneConflictReport()
{
const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
<lift version='0.10' producer='WeSay 1.0.0.0'>
<entry id='noChangesInEither' guid='c1ed1f9d-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='noChangesInEither' guid='c1ed1f9d-e382-11de-8a39-0800200c9a66' />
<entry id='addedByBoth' guid='c1ed1f9e-e382-11de-8a39-0800200c9a66' >
<sense id='somesense'>
<gloss lang='a'>
<text>editedByUs</text>
</gloss>
</sense>
</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='c1ed1f9d-e382-11de-8a39-0800200c9a66' />
<entry id='addedByBoth' guid='c1ed1f9e-e382-11de-8a39-0800200c9a66' >
<sense id='somesense'>
<gloss lang='a'>
<text>editedByThem</text>
</gloss>
</sense>
</entry>
</lift>";
// We win merge situation.
MergeSituation mergeSit = new NullMergeSituation();
DoMergeWithLiftEntryMergingStrategy(ancestor, ours, theirs,
mergeSit,
new[] { "lift/entry[@id='addedByBoth']/sense/gloss/text[text()='editedByUs']" }, new[] { "lift/entry[@id='addedByBoth']/sense/gloss/text[text()='editedByThem']" },
1, new List<Type> { typeof(XmlTextBothAddedTextConflict) },
4, new List<Type> { typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport) });
// They win merge situation.
mergeSit = new NullMergeSituationTheyWin();
DoMergeWithLiftEntryMergingStrategy(ancestor, ours, theirs,
mergeSit,
new[] { "lift/entry[@id='addedByBoth']/sense/gloss/text[text()='editedByThem']" }, new[] { "lift/entry[@id='addedByBoth']/sense/gloss/text[text()='editedByUs']" },
1, new List<Type> { typeof(XmlTextBothAddedTextConflict) },
4, new List<Type> { typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport) });
}
开发者ID:regnrand,项目名称:chorus,代码行数:45,代码来源:XmlMergeServiceTests.cs
示例6: 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
示例7: 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
示例8: TestBodyMerge
private void TestBodyMerge(string ancestorBody, string ourBody, string theirBody, Action<string> testsOnResultingFile, Action<ListenerForUnitTests> testsOnEventListener )
{
string ancestor = @"<?xml version='1.0' encoding='utf-8'?><html><body>"+ancestorBody+"</body></html>";
string theirs = @"<?xml version='1.0' encoding='utf-8'?><html><body>" + theirBody + "</body></html>";
string ours = @"<?xml version='1.0' encoding='utf-8'?><html><body>" + ourBody + "</body></html>";
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 };
new Bloom_ChorusPlugin.BloomHtmlFileTypeHandler().Do3WayMerge(mergeOrder);
testsOnResultingFile(mergeOrder.pathToOurs);
testsOnEventListener(listener);
}
}
开发者ID:JohnThomson,项目名称:testBloom,代码行数:19,代码来源:MergingTests.cs
示例9: DoMerge
private MergeResult DoMerge(string commonAncestor, string ourContent, string theirContent)
{
var result = new MergeResult();
using (var ours = new TempFile(ourContent))
using (var theirs = new TempFile(theirContent))
using (var ancestor = new TempFile(commonAncestor))
{
var situation = new NullMergeSituation();
var mergeOrder = new MergeOrder(ours.Path, ancestor.Path, theirs.Path, situation);
result.listener = new ListenerForUnitTests();
mergeOrder.EventListener = result.listener;
new BloomHtmlFileTypeHandler().Do3WayMerge(mergeOrder);
result.resultString = File.ReadAllText(ours.Path);
}
return result;
}
开发者ID:BloomBooks,项目名称:BloomDesktop,代码行数:17,代码来源:HtmlHandlerTests.cs
示例10: 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
示例11: 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
示例12: OneAddedOneTranslationWhileOtherAddedAnother_Merged
public void OneAddedOneTranslationWhileOtherAddedAnother_Merged()
{
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("</example>", "<translation><form lang='tp'><text>Dispela em i sentens bilong mi.</text></form></translation></example>");
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);
XmlTestHelper.AssertXPathMatchesExactlyOne(result, "//example");
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:34,代码来源:ExampleSentenceMergingTests.cs
示例13: UnchangedEntryInBoth_NotDuplicated
public void UnchangedEntryInBoth_NotDuplicated()
{
const string all = @"<?xml version='1.0' encoding='utf-8'?>
<lift version='0.10' producer='WeSay 1.0.0.0'>
<entry id='sameInBoth' guid='c1ed1f92-e382-11de-8a39-0800200c9a66' >
<lexical-unit>
<form lang='a'>
<text>form a</text>
</form>
</lexical-unit>
</entry>
</lift>";
using (var oursTemp = new TempFile(all))
using (var theirsTemp = new TempFile(all))
using (var ancestorTemp = new TempFile(all))
{
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='sameInBoth']");
XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/lexical-unit");
XmlTestHelper.AssertXPathMatchesExactlyOne(result, "lift/entry/lexical-unit/form/text");
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:30,代码来源:FileLevelMergeTests.cs
示例14: 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
示例15: 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
示例16: 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
示例17: EntryRemovedByUs_Removed
public void EntryRemovedByUs_Removed()
{
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[not(entry/@id='doomedByUs')]");
}
}
开发者ID:JessieGriffin,项目名称:chorus,代码行数:17,代码来源:FileLevelMergeTests.cs
示例18: DuplicateGuids_StillMergesWhatComesNext
public void DuplicateGuids_StillMergesWhatComesNext()
{
const string ours = @"<?xml version='1.0' encoding='utf-8'?>
<lift version='0.13' producer='WeSay 1.0.0.0'>
<entry id='everybody' guid='dded1f95-e382-11de-8a39-0800200c9add'/>
<entry id='newGuy' guid='aaed1f95-e382-11de-8a39-0800200c9a66' />
</lift>";
const string theirs = @"<?xml version='1.0' encoding='utf-8'?>
<lift version='0.13' producer='WeSay 1.0.0.0'>
<entry id='everybody' guid='dded1f95-e382-11de-8a39-0800200c9add'/>
<entry id='duplicate' guid='c1ed1f95-e382-11de-8a39-0800200c9a66' />
<entry id='duplicate' guid='c1ed1f95-e382-11de-8a39-0800200c9a66' />
<!-- everthing above this line was being merged, but not this -->
<entry id='lostBoy' guid='bbed1f95-e382-11de-8a39-0800200c9a66' />
</lift>";
const string ancestor = @"<?xml version='1.0' encoding='utf-8'?>
<lift version='0.13' producer='WeSay 1.0.0.0'>
<entry id='everybody' guid='dded1f95-e382-11de-8a39-0800200c9add'/>
</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) { EventLi
|
请发表评论