コード例 #1
0
        public void PcapProcessor_ReadTcpPackets_ReadSuccess()
        {
            // Arrange.
            var recievedPackets = new List <PcapProcessor.TcpPacket>();
            var processor       = new PcapProcessor.Processor();

            processor.TcpPacketArived +=
                (object sender, TcpPacketArivedEventArgs e) => recievedPackets.Add(e.Packet);

            // Act.
            processor.ProcessPcap(this.TcpFivePacketsFilePath);

            // Assert.
            Assert.AreEqual(5, recievedPackets.Count);
        }
コード例 #2
0
        public void PcapProcessor_ReadUdpPackets_ReadSuccess()
        {
            // Arrange.
            var recievedPackets = new List <PcapProcessor.UdpPacket>();
            var processor       = new PcapProcessor.Processor();

            processor.UdpPacketArived +=
                (object sender, UdpPacketArivedEventArgs e) => recievedPackets.Add(e.Packet);

            // Act.
            processor.ProcessPcap(this.UdpFilePath);

            // Assert (the file has 32 packets).
            Assert.AreEqual(32, recievedPackets.Count);
        }