public void MovingItemsResetsGuardProperties() { var child0 = new TestTreeItem(0); var child1 = new TestTreeItem(1); var child2 = new TestTreeItem(2); var child3 = new TestTreeItem(3); var child4 = new TestTreeItem(4); var parent = new TestTreeItem(0, child0, child1, child2, child3, child4); child0.CanMoveUp.Should().BeFalse(); child1.CanMoveUp.Should().BeTrue(); child1.MoveUp(); child0.CanMoveUp.Should().BeTrue(); child1.CanMoveUp.Should().BeFalse(); child3.CanMoveDown.Should().BeTrue(); child4.CanMoveDown.Should().BeFalse(); child3.MoveDown(); child3.CanMoveDown.Should().BeFalse(); child4.CanMoveDown.Should().BeTrue(); }
public void MovingAnItemUpPreservesIndexes() { var child0 = new TestTreeItem(0); var child1 = new TestTreeItem(1); var child2 = new TestTreeItem(2); var child3 = new TestTreeItem(3); var child4 = new TestTreeItem(4); var parent = new TestTreeItem(0, child0, child1, child2, child3, child4); child2.MoveUp(); for (int i = 0; i < parent.Children.Count; ++i) { parent.Children[i].Index.Should().Be(i); } parent.Children[0].Should().Be(child0); parent.Children[1].Should().Be(child2); parent.Children[2].Should().Be(child1); parent.Children[3].Should().Be(child3); parent.Children[4].Should().Be(child4); }