public void Diff_with_null_pathExpected_should_throw_exception() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); actual.Diff(expected, XmlPathRoot.Strict.Element(0), null, XmlOptions.Strict.Value); }
public void Diff_attributes_with_different_value() { var actual = new NodeAttribute(123, "planet", "Jupiter", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); AssertDiff(diff, new Diff(DiffType.MismatchedAttribute, XmlPathRoot.Strict.Element(0).Attribute(123), DiffTargets.Both)); }
public void Diff_attributes_ignoring_value_case() { var actual = new NodeAttribute(123, "planet", "sAtUrN", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), Options.IgnoreAttributesValueCase); Assert.IsTrue(diff.IsEmpty); }
public void Diff_attributes_with_name_differing_by_case() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(123, "PLANET", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); AssertDiff(diff, new Diff(DiffType.UnexpectedAttribute, XmlPathRoot.Strict.Element(0).Attribute(123), DiffTargets.Actual)); }
public void Diff_equal_attributes_with_different_index() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(456, "planet", "Saturn", 789); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); Assert.IsTrue(diff.IsEmpty); }
private int Find(NodeAttributeCollection source, NodeAttribute attribute, IList <int> mask) { int index = source.FindIndex(i => !mask.Contains(i) && attribute.Diff(source[i], XmlPathStrictElement.Root.Element(0), XmlPathStrictElement.Root.Element(0), options).IsEmpty); if (index < 0) { index = source.FindIndex(i => !mask.Contains(i) && attribute.AreNamesEqual(source[i].Name, options)); } return(index); }
public void Diff_attributes_with_different_value() { var actual = new NodeAttribute(123, "planet", "Jupiter", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); AssertDiff(diff, new Diff(DiffType.MismatchedAttribute, XmlPathRoot.Strict.Element(0).Attribute(123), DiffTargets.Both)); }
public void Diff_attributes_ignoring_value_case() { var actual = new NodeAttribute(123, "planet", "sAtUrN", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), Options.IgnoreAttributesValueCase); Assert.IsTrue(diff.IsEmpty); }
public void Diff_attributes_with_name_differing_by_case() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(123, "PLANET", "Saturn", 456); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); AssertDiff(diff, new Diff(DiffType.UnexpectedAttribute, XmlPathRoot.Strict.Element(0).Attribute(123), DiffTargets.Actual)); }
public void Diff_equal_attributes_with_different_index() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(456, "planet", "Saturn", 789); var diff = actual.Diff(expected, XmlPathRoot.Strict.Element(0), XmlPathRoot.Strict.Element(0), XmlOptions.Strict.Value); Assert.IsTrue(diff.IsEmpty); }
public void Diff_with_null_pathExpected_should_throw_exception() { var actual = new NodeAttribute(123, "planet", "Saturn", 456); var expected = new NodeAttribute(123, "planet", "Saturn", 456); actual.Diff(expected, XmlPathRoot.Strict.Element(0), null, XmlOptions.Strict.Value); }