public void LimitCalls(int max) { var markup = new EventBinding("NoParams"); if (max < 3) { markup.MaxCalls = max; } var del = markup.ProvideValue(CreateServiceProvider()) as Delegate; for (int i = 0; i < 10; i++) { del.DynamicInvoke(Elt, RoutedEventArgs); } target.Verify(i => i.NoParams(), Times.Exactly(max)); }
protected object FireEvent(EventBinding markup) { var del = markup.ProvideValue(CreateServiceProvider()) as Delegate; return(del.DynamicInvoke(Elt, RoutedEventArgs)); }