3
내가 작성한 동작을 단위 테스트하는 데 문제가 있습니다. 다음과 같이 동작은 다음과 같습니다Unit TextBox 동작 테스트
NumericTextBoxBehavior : Behavior<TextBox>
{
//handles few events like TextChanged ,PreviewTextInput , PreviewKeyDown , PreviewLostKeyboardFocus
//to give make it accept numeric values only
}
장치가이 코드
이제TextBox textBoxInvoker = new TextBox();
NumericTextBoxBehavior target = new NumericTextBoxBehavior();
System.Windows.Interactivity.Interaction.GetBehaviors(TextBoxInvoker).Add(target);
나는에
textBoxInvoker.RaiseEvent(routedEventArgs)
이 라우팅 이벤트 인수를 호출해야 이벤트를 인상을 썼다 동일한 테스트하는 동안 turn은 라우트 된 이벤트를 인수로 취합니다.
가짜 RoutedEventArgs를 생성하여 이벤트를 발생시키고 단위 테스트를 수행하는 방법을 알려주세요.
미리 감사드립니다.