public void receive(object source, ElapsedEventArgs e) { byte[] data = udpMessages.receive(); string message = Encoding.UTF8.GetString(data, 0, data.Length); string header = txtRemoteIP.Text + ":" + txtRemotePort.Text + " (Other Computer) \r\n"; txtConversation.Invoke((Action)(() => txtConversation.AppendText(header))); txtConversation.Invoke((Action)(() => txtConversation.AppendText(" " + message + " \r\n"))); }
public void testReceiveMessageCallReturnBytes() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock<UdpConnect>(); connector.Setup(udpConnector => udpConnector.receive()).Returns(data); var udp = new UdpIntegration(connector.Object); //Act var returnBytes = udp.receive(); //Assert Assert.AreEqual(data, returnBytes); }
public void testReceiveMessageCallReturnBytes() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock <UdpConnect>(); connector.Setup(udpConnector => udpConnector.receive()).Returns(data); var udp = new UdpIntegration(connector.Object); //Act var returnBytes = udp.receive(); //Assert Assert.AreEqual(data, returnBytes); }