示例#1
0
        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")));
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }