예제 #1
0
        public void ParsingTestSource()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(5), "-");
        }
예제 #2
0
        public void ParsingTestTimeDestination()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(6), "-");
        }
예제 #3
0
        public void ParsingTestTimeDestinationIp()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(4), "fe80::76c1:4fff:fefe:1b89");
        }
예제 #4
0
        public void ParsingTestSourceIp()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(3), "fe80::d1ec:8061:eeaf:3c78");
        }
예제 #5
0
        public void ParsingTestTimeLen()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(2), "86");
        }
예제 #6
0
        public void ParsingTestName()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(0), "ICMPv6");
        }
예제 #7
0
        public void ParsingTestTime()
        {
            var     icmp = new ICMPParser();
            PPacket pack = icmp.Parsing(icmpPacket, time, len);

            Assert.AreEqual(pack.GetPacket(1), "20:18:32 660");
        }
        public void UDPParserTest()
        {
            ICMPParser parser = new ICMPParser();

            var result = parser.ParsePcapFile(@"../../../../TestFiles/icmp.pcap");

            // Common properties
            Assert.That(result[0].Protocol, Is.EqualTo("ICMP"));
            Assert.That(result[0].Length, Is.EqualTo(74));
            Assert.That(result[0].DestinationAddress, Is.EqualTo("192.168.0.1"));
            Assert.That(result[0].DestinationPort, Is.EqualTo("16988"));
            Assert.That(result[0].SourceAddress, Is.EqualTo("192.168.0.89"));
            Assert.That(result[0].SourcePort, Is.EqualTo("2048"));
            Assert.That(result[0].TimeStamp.ToString("yyyy-MM-dd"), Is.EqualTo("2011-06-27"));

            // unusual
            Assert.That(result[0].Header,
                        Is.EqualTo("Checksum : 16988\r\nMessageType : Echo\r\nMessageTypeAndCode : Echo\r\nVariable : 33556736\r\n"));

            Assert.That(result.Count, Is.EqualTo(12));
        }