public void AdjustCarretIndexOrMoveToNeighbourTest() { AvalonTestRunner.RunInSTA(delegate { TextBox textBox = new TextBox(); TextBox neighbour = new TextBox(); textBox.Text = "10"; TimePicker.ExposeAdjustCarretIndexOrMoveToNeighbour(textBox, neighbour); Assert.AreEqual(1, textBox.CaretIndex, "Invalid caret index"); Assert.IsFalse(neighbour.IsFocused, "Neighbour is focused"); //the carrot is now moved...try to call the method again to focus the neighbour TimePicker.ExposeAdjustCarretIndexOrMoveToNeighbour(textBox, neighbour); Assert.IsTrue(neighbour.IsFocused, "Neighbour is not focused"); }); }