I am having trouble in unit testing a behavior i wrote. The behavior is as follows:
NumericTextBoxBehavior : Behavior<TextBox>
{
//handles few events like TextChanged ,PreviewTextInput , PreviewKeyDown , PreviewLostKeyboardFocus
//to give make it accept numeric values only
}
While unit testing the same I wrote this code
TextBox textBoxInvoker = new TextBox();
NumericTextBoxBehavior target = new NumericTextBoxBehavior();
System.Windows.Interactivity.Interaction.GetBehaviors(TextBoxInvoker).Add(target);
Now to raise the event I have to call
textBoxInvoker.RaiseEvent(routedEventArgs)
this Routed event args in turn takes routed event as argument.
Please help me how to create mock RoutedEventArgs to raise the event and further Unit test the behavior.
Thanks in advance.