예제 #1
0
        private void RunCompareSendReceive(TimeSpan duration, TimeSpan delay)
        {
            ReceiveTxSyslog txReceiver = new ReceiveTxSyslog(new IPEndPoint(IPAddress.Parse(TxSyslogTestSettings.TargetIP), TxSyslogTestSettings.TargetPort), 10);
            txReceiver.RunCount();
            var txRecdObs = txReceiver.ObserveTx();

            var receivedList = new List<Syslog>();
            txRecdObs
                .Subscribe<Syslog>(j => receivedList.Add(j));

            TxSyslogSender sysSend = new TxSyslogSender();
            var sendTask = sysSend.StartSendAsync(TxSyslogTestSettings.SourceIP,
                TxSyslogTestSettings.TargetIP,
                TxSyslogTestSettings.TargetPort,
                delay,
                duration,
                TxSyslogTestSettings.MessageList);

            var counter = sendTask.Result;

            Assert.AreEqual(counter, txReceiver.Counter);

            for (int c = 0; c < txReceiver.Counter; c++)
            {
                Assert.AreEqual(sysSend.SentList[c].Fac,receivedList[c].LogFacility);
                Assert.AreEqual(sysSend.SentList[c].Sev, receivedList[c].LogSeverity);
                Assert.AreEqual(TxSyslogTestSettings.SourceIP, receivedList[c].SourceIpAddress.ToString());
                Assert.AreEqual(TxSyslogTestSettings.TargetIP, receivedList[c].DestinationIpAddress.ToString());
                Assert.AreEqual(TxSyslogTestSettings.TargetPort, receivedList[c].DestinationPort);
                Assert.AreEqual(sysSend.SentList[c].Message.ToLowerInvariant(),receivedList[c].Message.ToLowerInvariant());
                Console.Out.WriteLine(receivedList[c].Message);
                Console.Out.WriteLine(sysSend.SentList[c].Message);
            }
        }
예제 #2
0
 private void Run(TimeSpan duration, TimeSpan delay)
 {
     ReceiveTxSyslog recTxSys = new ReceiveTxSyslog(new IPEndPoint(IPAddress.Parse(TxSyslogTestSettings.TargetIP), TxSyslogTestSettings.TargetPort), 10);
     recTxSys.RunCount();
     TxSyslogSender sendTxSys = new TxSyslogSender();
     var sendTask = sendTxSys.StartSendAsync(TxSyslogTestSettings.SourceIP,
          TxSyslogTestSettings.TargetIP,
          TxSyslogTestSettings.TargetPort,
          delay,
          duration,
          TxSyslogTestSettings.MessageList);
     var count = sendTask.Result;
     Assert.AreEqual(count, recTxSys.Counter);
     Console.Out.WriteLine(" {0},{1} ", count, recTxSys.Counter);
 }
예제 #3
0
        private void Run(TimeSpan duration, TimeSpan delay)
        {
            ReceiveTxSyslog recTxSys = new ReceiveTxSyslog(new IPEndPoint(IPAddress.Parse(TxSyslogTestSettings.TargetIP), TxSyslogTestSettings.TargetPort), 10);

            recTxSys.RunCount();
            TxSyslogSender sendTxSys = new TxSyslogSender();
            var            sendTask  = sendTxSys.StartSendAsync(TxSyslogTestSettings.SourceIP,
                                                                TxSyslogTestSettings.TargetIP,
                                                                TxSyslogTestSettings.TargetPort,
                                                                delay,
                                                                duration,
                                                                TxSyslogTestSettings.MessageList);
            var count = sendTask.Result;

            Assert.AreEqual(count, recTxSys.Counter);
            Console.Out.WriteLine(" {0},{1} ", count, recTxSys.Counter);
        }
예제 #4
0
        private void RunCompareSendReceive(TimeSpan duration, TimeSpan delay)
        {
            ReceiveTxSyslog txReceiver = new ReceiveTxSyslog(new IPEndPoint(IPAddress.Parse(TxSyslogTestSettings.TargetIP), TxSyslogTestSettings.TargetPort), 10);

            txReceiver.RunCount();
            var txRecdObs = txReceiver.ObserveTx();

            var receivedList = new List <Syslog>();

            txRecdObs
            .Subscribe <Syslog>(j => receivedList.Add(j));

            TxSyslogSender sysSend  = new TxSyslogSender();
            var            sendTask = sysSend.StartSendAsync(TxSyslogTestSettings.SourceIP,
                                                             TxSyslogTestSettings.TargetIP,
                                                             TxSyslogTestSettings.TargetPort,
                                                             delay,
                                                             duration,
                                                             TxSyslogTestSettings.MessageList);

            var counter = sendTask.Result;

            Assert.AreEqual(counter, txReceiver.Counter);

            for (int c = 0; c < txReceiver.Counter; c++)
            {
                Assert.AreEqual(sysSend.SentList[c].Fac, receivedList[c].LogFacility);
                Assert.AreEqual(sysSend.SentList[c].Sev, receivedList[c].LogSeverity);
                Assert.AreEqual(TxSyslogTestSettings.SourceIP, receivedList[c].SourceIpAddress.ToString());
                Assert.AreEqual(TxSyslogTestSettings.TargetIP, receivedList[c].DestinationIpAddress.ToString());
                Assert.AreEqual(TxSyslogTestSettings.TargetPort, receivedList[c].DestinationPort);
                Assert.AreEqual(sysSend.SentList[c].Message.ToLowerInvariant(), receivedList[c].Message.ToLowerInvariant());
                Console.Out.WriteLine(receivedList[c].Message);
                Console.Out.WriteLine(sysSend.SentList[c].Message);
            }
        }