public void TryFocusNeighbourControlTest()
        {
            AvalonTestRunner.RunInSTA(delegate
            {
                TextBox current = new TextBox();
                TextBox left    = new TextBox();
                TextBox right   = new TextBox();

                current.Text       = "10";
                current.CaretIndex = 2;

                //test going focus left with null
                TimePicker.ExposeTryFocusNeighbourControl(current, null, null, Key.Left);
                //now test with left textbox but with the invalid caret index
                TimePicker.ExposeTryFocusNeighbourControl(current, left, right, Key.Left);
                Assert.IsFalse(left.IsFocused, "left was focused");

                current.CaretIndex = 0;
                TimePicker.ExposeTryFocusNeighbourControl(current, left, right, Key.Left);
                Assert.IsTrue(left.IsFocused, "left was NOT focused");

                current = new TextBox();
                left    = new TextBox();
                right   = new TextBox();

                current.Text       = "10";
                current.CaretIndex = 0;
                //test going focus right with null
                TimePicker.ExposeTryFocusNeighbourControl(current, null, null, Key.Right);
                //now test with right textbox but with the invalid caret index
                TimePicker.ExposeTryFocusNeighbourControl(current, left, right, Key.Right);
                Assert.IsFalse(right.IsFocused, "right was focused");

                current.CaretIndex = 2;
                TimePicker.ExposeTryFocusNeighbourControl(current, left, right, Key.Right);
                Assert.IsTrue(right.IsFocused, "right was NOT focused");
            });
        }