Exemplo n.º 1
0
		public void OurOriginalTimestampKeptIfAnotherChangedWasMadeAndTheyDeletedParent()
		{
			const string commonAncestor =
@"<ownseq class='PartOfSpeech' guid ='c1ed6db0-e382-11de-8a39-0800200c9a66'>
	<DateModified val='2000-1-1 23:59:59.000' />
	<Name>
			<AUni
				ws='en'>commonName</AUni>
	</Name>
</ownseq>";
			var ourContent = commonAncestor.Replace("2000-1-1 23:59:59.000", "2002-1-1 23:59:59.000").Replace("commonName", "ourModifiedName");

			var ancestorNode = XmlUtilities.GetDocumentNodeFromRawXml(commonAncestor, new XmlDocument());
			var ancestorModPropNode = ancestorNode.SelectSingleNode("DateModified");
			var ourNode = XmlUtilities.GetDocumentNodeFromRawXml(ourContent, new XmlDocument());
			var ourModPropNode = ourNode.SelectSingleNode("DateModified");
			var premerger = new PreferMostRecentTimePreMerger();
			premerger.Premerge(new ListenerForUnitTests(), ref ourModPropNode, null, ancestorModPropNode);

			Assert.AreEqual("2002-1-1 23:59:59.000", ourModPropNode.Attributes["val"].Value);
		}
Exemplo n.º 2
0
		public void TheirOriginalTimestampRestoredToAncestorValueIfOnlyChangeWasTimestampAndWeDeletedParent()
		{
			const string commonAncestor =
@"<ownseq class='PartOfSpeech' guid ='c1ed6db0-e382-11de-8a39-0800200c9a66'>
	<DateModified val='2000-1-1 23:59:59.000' />
	<Name>
			<AUni
				ws='en'>commonName</AUni>
	</Name>
</ownseq>";
			var theirContent = commonAncestor.Replace("2000-1-1 23:59:59.000", "2002-1-1 23:59:59.000");

			var ancestorNode = XmlUtilities.GetDocumentNodeFromRawXml(commonAncestor, new XmlDocument());
			var ancestorModPropNode = ancestorNode.SelectSingleNode("DateModified");
			var theirNode = XmlUtilities.GetDocumentNodeFromRawXml(theirContent, new XmlDocument());
			var theirModPropNode = theirNode.SelectSingleNode("DateModified");
			var premerger = new PreferMostRecentTimePreMerger();
			XmlNode ourNode = null;
			premerger.Premerge(new ListenerForUnitTests(), ref ourNode, theirModPropNode, ancestorModPropNode);

			Assert.AreEqual("2000-1-1 23:59:59.000", theirModPropNode.Attributes["val"].Value);
		}