Check() public method

public Check ( ) : bool
return bool
Ejemplo n.º 1
0
        public void ConstructAndChangeProps1()
        {
            byte[] packetData = TestPacket1;

            Ssm2ReadBlockRequest p = new Ssm2ReadBlockRequest ();
            p.Source = Ssm2Device.DiagnosticToolF0;
            p.Destination = Ssm2Device.Engine10;
            p.Address = 0x200000;
            p.DataCount = 128;

            // should be ok after setting Data but don't depend on it!
            Assert.AreEqual (packetData.Length, p.Size, "Size before Construct");

            p.Finish ();

            AssertData1 (p);

            // changing some properties now

            p.DataCount = 129;
            // needed to calc new checksum
            p.Finish ();

            // check
            Assert.AreEqual (packetData.Length, p.Size, "Size2");
            Assert.AreEqual (true, p.Check (), "Check2()");
            Assert.AreEqual (Ssm2Device.Engine10, p.Destination, "Destination2");
            Assert.AreEqual (Ssm2Device.DiagnosticToolF0, p.Source, "Source2");
            Assert.AreEqual (Ssm2Command.ReadBlockRequestA0, p.Command, "Command2");
            Assert.AreEqual (0x200000, p.Address, "Address2");
            Assert.AreEqual (129, p.DataCount, "DataCount2");
        }
Ejemplo n.º 2
0
        public void ConstructAndChangeProps1()
        {
            byte[] packetData = TestPacket1;

            Ssm2ReadBlockRequest p = new Ssm2ReadBlockRequest();

            p.Source      = Ssm2Device.DiagnosticToolF0;
            p.Destination = Ssm2Device.Engine10;
            p.Address     = 0x200000;
            p.DataCount   = 128;

            // should be ok after setting Data but don't depend on it!
            Assert.AreEqual(packetData.Length, p.Size, "Size before Construct");

            p.Finish();

            AssertData1(p);

            // changing some properties now

            p.DataCount = 129;
            // needed to calc new checksum
            p.Finish();

            // check
            Assert.AreEqual(packetData.Length, p.Size, "Size2");
            Assert.AreEqual(true, p.Check(), "Check2()");
            Assert.AreEqual(Ssm2Device.Engine10, p.Destination, "Destination2");
            Assert.AreEqual(Ssm2Device.DiagnosticToolF0, p.Source, "Source2");
            Assert.AreEqual(Ssm2Command.ReadBlockRequestA0, p.Command, "Command2");
            Assert.AreEqual(0x200000, p.Address, "Address2");
            Assert.AreEqual(129, p.DataCount, "DataCount2");
        }
Ejemplo n.º 3
0
        static void AssertData1(Ssm2ReadBlockRequest p)
        {
            byte[] packetData = TestPacket1;

            Assert.AreEqual(packetData.Length, p.Size, "Size");
            Assert.AreEqual(true, p.Check(), "Check()");

            Assert.AreEqual(Ssm2Device.Engine10, p.Destination, "Destination");
            Assert.AreEqual(Ssm2Device.DiagnosticToolF0, p.Source, "Source");
            Assert.AreEqual(Ssm2Command.ReadBlockRequestA0, p.Command, "Command");

            Assert.AreEqual(0x200000, p.Address, "Address");
            Assert.AreEqual(128, p.DataCount, "Data");

            byte[] bytes = p.ToBytesCopy();
            for (int i = 0; i < packetData.Length; i++)
            {
                Assert.AreEqual(packetData[i], bytes[i], "bytes[i]");
            }
        }
Ejemplo n.º 4
0
        public void ConstructAndChangeProps2()
        {
            Ssm2ReadBlockRequest p = new Ssm2ReadBlockRequest();

            p.Source      = Ssm2Device.DiagnosticToolF0;
            p.Destination = Ssm2Device.Engine10;
            p.Address     = 0x123456;
            p.DataCount   = 1;

            p.Finish();

            Assert.AreEqual(11, p.Size, "Size");
            Assert.AreEqual(true, p.Check(), "Check()");

            Assert.AreEqual(Ssm2Device.DiagnosticToolF0, p.Source, "Source");
            Assert.AreEqual(Ssm2Device.Engine10, p.Destination, "Destination");

            Assert.AreEqual(Ssm2Command.ReadBlockRequestA0, p.Command, "Command");

            Assert.AreEqual(0x123456, p.Address, "Address");
            Assert.AreEqual(1, p.DataCount, "DataCount");
        }
Ejemplo n.º 5
0
        public void ConstructAndChangeProps2()
        {
            Ssm2ReadBlockRequest p = new Ssm2ReadBlockRequest ();
            p.Source = Ssm2Device.DiagnosticToolF0;
            p.Destination = Ssm2Device.Engine10;
            p.Address = 0x123456;
            p.DataCount = 1;

            p.Finish ();

            Assert.AreEqual (11, p.Size, "Size");
            Assert.AreEqual (true, p.Check (), "Check()");

            Assert.AreEqual (Ssm2Device.DiagnosticToolF0, p.Source, "Source");
            Assert.AreEqual (Ssm2Device.Engine10, p.Destination, "Destination");

            Assert.AreEqual (Ssm2Command.ReadBlockRequestA0, p.Command, "Command");

            Assert.AreEqual (0x123456, p.Address, "Address");
            Assert.AreEqual (1, p.DataCount, "DataCount");
        }
Ejemplo n.º 6
0
        static void AssertData1(Ssm2ReadBlockRequest p)
        {
            byte[] packetData = TestPacket1;

            Assert.AreEqual (packetData.Length, p.Size, "Size");
            Assert.AreEqual (true, p.Check (), "Check()");

            Assert.AreEqual (Ssm2Device.Engine10, p.Destination, "Destination");
            Assert.AreEqual (Ssm2Device.DiagnosticToolF0, p.Source, "Source");
            Assert.AreEqual (Ssm2Command.ReadBlockRequestA0, p.Command, "Command");

            Assert.AreEqual (0x200000, p.Address, "Address");
            Assert.AreEqual (128, p.DataCount, "Data");

            byte[] bytes = p.ToBytesCopy ();
            for (int i = 0; i < packetData.Length; i++) {
                Assert.AreEqual (packetData[i], bytes[i], "bytes[i]");
            }
        }