예제 #1
0
        public void CanAppplyPatch()
        {
            var b = XElement.Parse("<a><z id='1' code='2' name='2'/><z id='3' code='3' name='4'/></a>");
            var n = XElement.Parse("<a><z id='3' set-code='4' name='2'/><z id='1' set-code='3' name='4'/></a>");

            Assert.True(new XDiffGenerator().IsDiff(b, n));
            var result = new XDiffGenerator().GetDiff(b, n).Apply(b);

            Console.WriteLine(result.ToString());
            Assert.False(new XDiffGenerator().IsDiff(b, n));
        }
예제 #2
0
        public void CanAppplyPatchHierarchcallyWithNameChanges()
        {
            var b    = XElement.Parse("<a><z code='2' name='y'/><z id='3' code='4'><x id='5' name='x'/></z></a>");
            var n    = XElement.Parse("<a><u code='2' name='y'><y id='5' name='x'/></u><z id='3' code='4'></z></a>");
            var opts = new XDiffOptions {
                IsHierarchy = true, IsNameIndepended = true
            };

            GetResult(b, n, opts);
            Assert.True(new XDiffGenerator(opts).IsDiff(b, n));
            var result = new XDiffGenerator(opts).GetDiff(b, n).Apply(b, opts);

            Console.WriteLine(result.ToString());
            Assert.False(new XDiffGenerator(opts).IsDiff(b, n));
        }
예제 #3
0
		public void CanAppplyPatchHierarchcallyWithNameChanges()
		{
			var b = XElement.Parse("<a><z code='2' name='y'/><z id='3' code='4'><x id='5' name='x'/></z></a>");
			var n = XElement.Parse("<a><u code='2' name='y'><y id='5' name='x'/></u><z id='3' code='4'></z></a>");
			var opts = new XDiffOptions{IsHierarchy = true, IsNameIndepended = true};
			GetResult(b, n, opts);
			Assert.True(new XDiffGenerator(opts).IsDiff(b, n));
			var result = new XDiffGenerator(opts).GetDiff(b, n).Apply(b,opts);
			Console.WriteLine(result.ToString());
			Assert.False(new XDiffGenerator(opts).IsDiff(b, n));
		}
예제 #4
0
		public void CanAppplyPatch()
		{
			var b = XElement.Parse("<a><z id='1' code='2' name='2'/><z id='3' code='3' name='4'/></a>");
			var n = XElement.Parse("<a><z id='3' set-code='4' name='2'/><z id='1' set-code='3' name='4'/></a>");
			Assert.True(new XDiffGenerator().IsDiff(b, n));
			var result = new XDiffGenerator().GetDiff(b,n).Apply(b);
			Console.WriteLine(result.ToString());
			Assert.False(new XDiffGenerator().IsDiff(b,n));
		}