예제 #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");
        }
예제 #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");
        }
예제 #3
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");
        }
예제 #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");
        }