Ejemplo n.º 1
0
 public void Start()
 {
     _dbReceiver.Start();
     _sisposReceiver.Start();
     _sisposDataProcessor.Start();
     _sisposTransmitter.Start();
 }
Ejemplo n.º 2
0
        public void ReceivePackets()
        {
            if (!_settings.ListenPort.HasValue)
            {
                throw new ArgumentException("Listen port is not initialized");
            }

            var msgCache     = new MessageCache();
            var sender       = new UdpPacketSender();
            var packetsCount = 10;

            var msg = Encoding.ASCII.GetBytes("$PANSPT,33,22,1*88\r\n$PANSPT,44,55,1*99\r\n");

            using (var receiver = new SISPOSReceiver(_settings, msgCache))
            {
                receiver.Start();

                for (int i = 0; i < packetsCount; i++)
                {
                    sender.SendToLocalhost(_settings.ListenPort.Value, msg);
                }
            }

            Assert.AreEqual(packetsCount, msgCache.Count, "The message was not received");
            Assert.IsTrue(msgCache.Pop().ContainsSubArray(msg));
        }