public void WhenSameSourceSamePropertySameValue_ReturnsNull() { var source = new PrimitiveData("tn", 1); var current = new PrimitiveObjectTreeItem(source.Value, null, "pn", source); var next = new PrimitiveObjectTreeItem(source.Value, null, "pn", source); var actual = TreeComparer.FromPrimitive(current, next); Assert.That(actual, Is.Null); }
public void WhenDifferentSourceSamePropertyDifferentValue_DifferenceItemIsMarkedAsModified() { var currentSource = new PrimitiveData("tn", 1); var nextSource = new PrimitiveData("tn", 2); var current = new PrimitiveObjectTreeItem(currentSource.Value, null, "pn", currentSource); var next = new PrimitiveObjectTreeItem(nextSource.Value, null, "pn", nextSource); var actual = TreeComparer.FromPrimitive(current, next); Assert.That(actual.DiffType, Is.EqualTo(DiffType.Modified)); }
public void WhenDifferentSourceSamePropertyDifferentValue_ReturnsDifferenceItem() { var currentSource = new PrimitiveData("tn", 1); var nextSource = new PrimitiveData("tn", 2); var current = new PrimitiveObjectTreeItem(currentSource.Value, null, "pn", currentSource); var next = new PrimitiveObjectTreeItem(nextSource.Value, null, "pn", nextSource); var actual = TreeComparer.FromPrimitive(current, next); Assert.That(actual, Is.Not.Null); }
public void WhenDifferentSourceSamePropertyDifferentValue_DifferenceItemContainsBothItems() { var currentSource = new PrimitiveData("tn", 1); var nextSource = new PrimitiveData("tn", 2); var current = new PrimitiveObjectTreeItem(currentSource.Value, null, "pn", currentSource); var next = new PrimitiveObjectTreeItem(nextSource.Value, null, "pn", nextSource); var actual = TreeComparer.FromPrimitive(current, next); Assert.That(actual.Current, Is.SameAs(current)); Assert.That(actual.Next, Is.SameAs(next)); }