public void Client_Disconnect_ServerShouldFireClientDisconnectedEvent() { // Prepare var isDisconnected = false; _server = new ServerPipeline(); _server.ClientDisconnectedEvent += (sender, args) => { isDisconnected = true; }; _server.Start(); Assert.IsFalse(isDisconnected); _client = new ClientPipeline(_server.ServerId); _client.Start(); // Act _client.Stop(); _client = null; Thread.Sleep(100); // Verify Assert.IsTrue(isDisconnected); }
public void TearDown() { if (_client != null) { _client.Stop(); _client = null; } if (_server != null) { _server.Stop(); _server = null; } }