예제 #1
0
        public void CreateByProperties()
        {
            // Ssm2InitRequest p = new Ssm2InitRequest ();
            // p.Destination = Ssm2Device.Engine10;
            // p.Source = Ssm2Device.DiagnosticToolF0;

            // same effect, using object initializer syntax:
            Ssm2InitRequest p = new Ssm2InitRequest {
                Destination = Ssm2Device.Engine10, Source = Ssm2Device.DiagnosticToolF0
            };

            // Important: packet is still invalid at this point!

            // don't depend on Size yet even though it is correct for this type
            // Assert.AreEqual (packetData.Length, p.Size, "Size");
            // No checksum yet so check will fail.
            Assert.AreEqual(false, p.Check(), "Check()");

            // Important: as with default constructor
            // the object does not know when all properties have been set.
            // This call will calculate the checksum, making packet complete.
            p.Finish();
            // packet is now complete

            AssertProperties1(p);
        }
예제 #2
0
        public void CreateByProperties()
        {
            // Ssm2InitRequest p = new Ssm2InitRequest ();
            // p.Destination = Ssm2Device.Engine10;
            // p.Source = Ssm2Device.DiagnosticToolF0;

            // same effect, using object initializer syntax:
            Ssm2InitRequest p = new Ssm2InitRequest { Destination = Ssm2Device.Engine10, Source = Ssm2Device.DiagnosticToolF0 };
            // Important: packet is still invalid at this point!

            // don't depend on Size yet even though it is correct for this type
            // Assert.AreEqual (packetData.Length, p.Size, "Size");
            // No checksum yet so check will fail.
            Assert.AreEqual (false, p.Check (), "Check()");

            // Important: as with default constructor
            // the object does not know when all properties have been set.
            // This call will calculate the checksum, making packet complete.
            p.Finish ();
            // packet is now complete

            AssertProperties1 (p);
        }