public void UITestControlCollection_CanSetElementByIndex()
        {
            UITestControlCollection siblings = CheckBox.GetParent().GetChildren();

            siblings.Should().NotBeNullOrEmpty("because the CheckBox should have siblings");

            var lastUiTestControl = siblings.Last();

            siblings.Add(new UITestControl());

            siblings[siblings.Count - 1] = lastUiTestControl;
            siblings
            .Last()
            .ShouldBeEquivalentTo(
                lastUiTestControl,
                "because we copied the second last element to be the last.");
        }
        public void UITestControlCollection_CanAddRange()
        {
            UITestControlCollection siblings = CheckBox.GetParent().GetChildren();

            siblings.Should().NotBeNullOrEmpty("because the CheckBox should have siblings");

            var beforeCount = siblings.Count;
            var lastItem    = siblings.Last();
            var toAdd       = new UITestControlCollection();

            toAdd.Add(lastItem);
            toAdd.Add(lastItem);

            siblings
            .AddRange(toAdd);

            siblings
            .Count
            .Should()
            .Be(beforeCount + 2, "because we added 2 Items");
        }
        public void UITestControlCollection_CanRemoveItem()
        {
            UITestControlCollection siblings = CheckBox.GetParent().GetChildren();

            siblings.Should().NotBeNullOrEmpty("because the CheckBox should have siblings");

            var countBeforeRemoving = siblings.Count;
            var lastItem            = siblings.Last();

            siblings
            .Remove(lastItem)
            .Should()
            .BeTrue("because it should be possible to remove an Item.");

            siblings
            .Count
            .Should()
            .Be(countBeforeRemoving - 1, "because count should change.");

            siblings
            .Contains(lastItem)
            .Should()
            .BeFalse("because the item has been removed.");
        }