public void WhenBothHaveNoChildren_ReturnsNull()
            {
                var current = CreateListTreeItem();
                var next    = CreateListTreeItem();

                var actual = TreeComparer.FromList(current, next);

                Assert.That(actual, Is.Null);
            }
            public void WhenKeyItemChanges_MarkItAsModified()
            {
                var first    = CreateStateObjectTreeItem(CreateNamedPrimitiveTreeItem("Text", "a"));
                var modified = CreateStateObjectTreeItem(CreateNamedPrimitiveTreeItem("Text", "b"));
                var current  = CreateListTreeItem(first);
                var next     = CreateListTreeItem(modified);

                var actual = TreeComparer.FromList(current, next);

                Assert.That(actual.Children.Length, Is.EqualTo(1));
                Assert.That(actual.DiffType, Is.EqualTo(DiffType.Modified));
            }
            public void WhenCurrentHasChildAndNextHasNone_ContainsProperChildren()
            {
                var current = CreateListTreeItem(CreatePrimitiveTreeItem(5));
                var next    = CreateListTreeItem();

                var actual = TreeComparer.FromList(current, next);

                Assert.That(actual.Children.Length, Is.EqualTo(1));
                Assert.That(actual.Children[0].Current, Is.SameAs(current.Children[0]));
                Assert.That(actual.Children[0].Next, Is.Null);
                Assert.That(actual.Children[0].DiffType, Is.EqualTo(DiffType.Removed));
            }
            public void WhenCurrentHasChildAndNextHasNone_ReturnsModified()
            {
                var current = CreateListTreeItem(CreatePrimitiveTreeItem(5));
                var next    = CreateListTreeItem();

                var actual = TreeComparer.FromList(current, next);

                Assert.That(actual, Is.InstanceOf <DifferenceItemContainer>());
                Assert.That(actual.DiffType, Is.EqualTo(DiffType.Modified));
                Assert.That(actual.Current, Is.SameAs(current));
                Assert.That(actual.Next, Is.SameAs(next));
            }