public IEnumerator ConnectedClientCanReceiveData() { var testConnectionClient = new TcpConnectionClient(); testConnectionClient.ConnectToServer(_localIpAddress, _testPort); yield return(new WaitForSeconds(0.5f)); _testListener.SendDataToAllClients("test"); yield return(new WaitForSeconds(0.5f)); Assert.IsTrue(testConnectionClient.HasData); yield return(new WaitForEndOfFrame()); Assert.AreEqual("test", testConnectionClient.GetData()); }
public IEnumerator ServerCanSendDataToClient() { var testClient = new TcpClient(); bool received = false; _server.DataReceived += m => received = true; yield return(ConnectTestClientToServer(testClient)); _server.SendDataToAllClients("test"); yield return(new WaitForSeconds(0.5f)); Assert.IsTrue(testClient.GetStream().DataAvailable); _server.Tick(); Assert.IsFalse(received); }