public void EventHandlerCommonEventArgs() { var provider = new MyEventProvider1EventHandler <TreeChangedEventArgs> (); var listener = new MyEventListener1EventHandler <TreeChangedEventArgs>(); listener.Listen(provider); provider.Raise(); Assert.That(listener.Count, Is.EqualTo(listener.Count), "listener.Count"); }
public void EventHandlerNewEventArgsˑPerformanceTest() { var provider = new MyEventProvider1EventHandler <MyEventArgs> (); var listener = new MyEventListener1EventHandler <MyEventArgs>(); listener.Listen(provider); provider.Raise4PerformanceTest(); Assert.That(listener.Count, Is.EqualTo(listener.Count), "listener.Count"); }
public void PerformanceTest2() { var provider = new MyEventProvider1EventHandler <TreeChangedEventArgs>(); var listener = new MyEventListener1EventHandler <TreeChangedEventArgs>(); listener.Listen(provider); var count = 1000000; var stopwatch = new Stopwatch(); stopwatch.Start(); for (int i = 0; i < count; i++) { provider.Raise(); } stopwatch.Stop(); Assert.That(listener.Count, Is.EqualTo(count), "listener.Count"); Trace.WriteLine(string.Format("Time: {0}", new TimeSpan(stopwatch.ElapsedTicks * 1))); }