public void Typing_Beginning_With_0_Should_Not_Modify_Text_When_Bound_To_Int()
        {
            using (Start())
            {
                var source = new Class1();
                var target = new MaskedTextBox
                {
                    DataContext = source,
                    Template    = CreateTemplate(),
                };

                target.ApplyTemplate();
                target.Bind(TextBox.TextProperty, new Binding(nameof(Class1.Foo), BindingMode.TwoWay));

                Assert.Equal("0", target.Text);

                target.CaretIndex = 1;
                target.RaiseEvent(new TextInputEventArgs
                {
                    RoutedEvent = InputElement.TextInputEvent,
                    Text        = "2",
                });

                Assert.Equal("02", target.Text);
            }
        }
 private void RaiseTextEvent(MaskedTextBox textBox, string text)
 {
     textBox.RaiseEvent(new TextInputEventArgs
     {
         RoutedEvent = InputElement.TextInputEvent,
         Text        = text
     });
 }
 private void RaiseKeyEvent(MaskedTextBox textBox, Key key, KeyModifiers inputModifiers)
 {
     textBox.RaiseEvent(new KeyEventArgs
     {
         RoutedEvent  = InputElement.KeyDownEvent,
         KeyModifiers = inputModifiers,
         Key          = key
     });
 }