public void Reconnect_ShouldRaiseStopped() { var done = new AutoResetEvent(false); void SetAutoResetEvent() { done.Set(); } var client = new SpeedDateClient(); client.Started += SetAutoResetEvent; client.Start(new DefaultConfigProvider( new NetworkConfig(SetUp.MasterServerIp, SetUp.MasterServerPort), //Connect to port PluginsConfig.DefaultPeerPlugins)); //Load peer-plugins only done.WaitOne(TimeSpan.FromSeconds(30)).ShouldBeTrue(); client.Started -= SetAutoResetEvent; client.Stopped += SetAutoResetEvent; client.Reconnect(); done.WaitOne(TimeSpan.FromSeconds(30)).ShouldBeTrue(); }