Ejemplo n.º 1
0
        public void StatusPacketTest()
        {
            var captureFilePath = "Packets\\Raw3.bin";

            byte[] testPacketAll = File.ReadAllBytes(captureFilePath);
            byte[] testPacket    = testPacketAll.Skip(1472).ToArray();
            Assert.IsNotNull(testPacket);
            Assert.IsTrue(testPacket.Length > 0);

            IncomingRawUdpPacket packet = new IncomingRawUdpPacket(testPacket);

            Assert.IsTrue(packet.GetPacketType() == PacketType.Status);

            DetectionStatusPacket detPacket = ((DetectionStatusPacket)packet.Generate());

            Assert.IsNotNull(detPacket);


            var statusPacket = detPacket.GetPacket();

            Assert.IsTrue(statusPacket.IsReady());


            Assert.IsTrue(statusPacket.Gpsday == 2);
            Assert.IsTrue(statusPacket.Gpsmonth == 6);
            Assert.IsTrue(statusPacket.Gpshour == 6);
            Assert.IsTrue(statusPacket.Gpslat < -27);
            Assert.IsTrue(statusPacket.Gpslat > -28);
        }
Ejemplo n.º 2
0
        public void BadStatusPacketTest()
        {
            var captureFilePath = "Packets\\emptystatuscapture.bin";

            byte[] testPacket           = File.ReadAllBytes(captureFilePath);
            IncomingRawUdpPacket packet = new IncomingRawUdpPacket(testPacket);

            Assert.IsTrue(packet.GetPacketType() == PacketType.Status);
            DetectionStatusPacket statusPacket = (DetectionStatusPacket)packet.Generate();

            Assert.IsFalse(statusPacket.GetPacket().IsReady());
        }