Ejemplo n.º 1
0
        public void PutStringTestAndGetStringTest()
        {
            // Arrange
            string   stringPut = "Test string.";
            BasePack basePack  = new BasePack();

            // Act
            basePack.PutString(stringPut);
            string stringGet = basePack.GetString();

            // Assert
            Assert.AreEqual(stringPut, stringGet);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Publish packs in pack_queue
        /// </summary>
        /// <exception cref="Exception"></exception>
        protected override void Publish()
        {
            byte[] buffer;

            while (isInputEnabled)
            {
                IPEndPoint info = null;
                try
                {
                    buffer = listener.Receive(ref info);
                    BasePack.PutString(buffer, info.Address.ToString(), 1);
                    pack_queue.Enqueue(buffer);
                    manualEvent.Set();
                }
                catch (Exception e)
                {
                    OnConnectionClosedCall();
                    Console.WriteLine(e.Message);
                    Console.WriteLine("Connection closed! Host do not answer.");
                }
            }
        }
Ejemplo n.º 3
0
        public void PutStringTestAndGetStringTest()
        {
            // Arrange
            string stringPut = "Test string.";
            BasePack basePack = new BasePack();

            // Act
            basePack.PutString(stringPut);
            string stringGet = basePack.GetString();

            // Assert
            Assert.AreEqual(stringPut, stringGet);
        }