private void btnSend_Click(object sender, EventArgs e) { udpMessages.send(txtMessage.Text); string header = udpMessages + ":" + txtPort.Text + " (Me) \r\n"; txtConversation.AppendText(header); txtConversation.AppendText(" " + txtMessage.Text + " \r\n"); txtMessage.Text = string.Empty; txtMessage.Focus(); }
public void testSendMessageWithoutConnectionReturnException() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new UdpConnector("127.0.0.1", 9999, 9998); var udp = new UdpIntegration(connector); //Act and Assert udp.close(); udp.send(message); }
public void testSendShortMessageCallReturnBytesLength() { //Arrange short message = 5; var data = BitConverter.GetBytes(message); var connector = new Mock <UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert Assert.AreEqual(data.Length, returnBytes); }
public void testSendStringMessageCallReturnBytesLength() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock <UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert Assert.AreEqual(data.Length, returnBytes); }
public void testSendMessageCallSendInConnector() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock <UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert connector.Verify(conn => conn.send(data, data.Length), Times.Once()); }
public void testSendMessageCallSendInConnector() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock<UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert connector.Verify(conn => conn.send(data, data.Length), Times.Once()); }
public void testSendStringMessageCallReturnBytesLength() { //Arrange String message = "Teste"; var data = Encoding.ASCII.GetBytes(message); var connector = new Mock<UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert Assert.AreEqual(data.Length, returnBytes); }
public void testSendShortMessageCallReturnBytesLength() { //Arrange short message = 5; var data = BitConverter.GetBytes(message); var connector = new Mock<UdpConnect>(); connector.Setup(udpConnector => udpConnector.send(data, data.Length)).Returns(data.Length); var udp = new UdpIntegration(connector.Object); //Act int returnBytes = udp.send(message); //Assert Assert.AreEqual(data.Length, returnBytes); }