示例#1
0
        public void TestGetSubsystem()
        {
            SerialNumber serial = new SerialNumber("01300000000000000000000000000001");
            Firmware     fw     = new Firmware(0x3, 1, 2, 3);
            Subsystem    ss     = new Subsystem(fw.GetSubsystemCode(new SerialNumber()));

            Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect.");
        }
示例#2
0
        public void TestNotEqual()
        {
            Firmware fw  = new Firmware(0x3, 1, 2, 3);
            Firmware fw1 = new Firmware(0x3, 2, 2, 3);

            Assert.AreEqual(false, fw1 == fw, "== is incorrect.");
            Assert.AreEqual(true, fw1 != fw, "!= is incorrect.");
        }
示例#3
0
        public void TestGetSubsystemVersion()
        {
            SerialNumber serial = new SerialNumber("01300000000000000000000000000001");
            Firmware     fw     = new Firmware(Subsystem.SUB_600KHZ_4BEAM_20DEG_PISTON_3, 0, 2, 3);
            Subsystem    ss     = new Subsystem(fw.GetSubsystemCode(serial));

            Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect.");
        }
示例#4
0
        public void TestEqualEqual()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);

            byte[]   encoded = fw.Encode();
            Firmware fw1     = new Firmware(encoded);

            Assert.AreEqual(true, fw1 == fw, "== is incorrect.");
        }
示例#5
0
        public void TestConstructor2()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);

            Assert.AreEqual(1, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(2, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(3, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(0x3, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");
        }
示例#6
0
        public void TestConstructor()
        {
            Firmware fw = new Firmware();

            Assert.AreEqual(0, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(0, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(0, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(Subsystem.EMPTY_CODE, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");
        }
示例#7
0
        public void TestConstructor()
        {
            Firmware fw = new Firmware();

            Assert.AreEqual(0, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(0, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(0, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(Subsystem.EMPTY_CODE, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");
        }
示例#8
0
        public void TestConstructor2()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);

            Assert.AreEqual(1, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(2, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(3, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(0x3, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");
        }
示例#9
0
        public void TestEncodeDecode()
        {
            Firmware fw = new Firmware(0x1, 5, 2, 3);

            byte[] encoded = fw.Encode();

            Firmware fw1 = new Firmware(encoded);

            Assert.AreEqual(5, fw1.FirmwareMajor, "FW1 Major is incorrect.");
            Assert.AreEqual(2, fw1.FirmwareMinor, "FW1 Minor is incorrect.");
            Assert.AreEqual(3, fw1.FirmwareRevision, "FW1 Revision is incorrect.");
            Assert.AreEqual(0x1, fw1.GetSubsystemCode(new SerialNumber()), "FW1 Subsystem Code is incorrect.");
            Assert.AreEqual(fw1, fw, "Firmware is not ==");
            Assert.AreEqual(true, fw1 == fw, "== is incorrect.");
        }
示例#10
0
        /// <summary>
        /// Determine if the given object is equal to this
        /// object.  This will check if the firmware version match.
        /// </summary>
        /// <param name="obj">Object to compare with this object.</param>
        /// <returns>TRUE = Firmware Versions matched.</returns>
        public override bool Equals(object obj)
        {
            //Check for null and compare run-time types.
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            Firmware p = (Firmware)obj;

            return((FirmwareMajor == p.FirmwareMajor) &&
                   (FirmwareMinor == p.FirmwareMinor) &&
                   (FirmwareRevision == p.FirmwareRevision) &&
                   (SubsystemCode == p.SubsystemCode));
        }
示例#11
0
        public void TestEncode()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);

            Assert.AreEqual(1, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(2, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(3, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(0x3, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");

            byte[] encoded = fw.Encode();

            Assert.AreEqual(4, encoded.Length, "Encoded length is incorrect.");
            Assert.AreEqual(1, encoded[Firmware.MAJOR_START], "Encoded Major is incorrect.");
            Assert.AreEqual(2, encoded[Firmware.MINOR_START], "Encoded Minor is incorrect.");
            Assert.AreEqual(3, encoded[Firmware.REVISION_START], "Encoded Revision is incorrect.");
            Assert.AreEqual(0x3, encoded[Firmware.SUBSYSTEM_START], "Encoded Subsystem Code is incorrect.");
        }
示例#12
0
 /// <summary>
 /// Initialize all the values.
 /// </summary>
 public AdcpSerialOptions()
 {
     SerialOptions = new SerialOptions();
     SerialNumber = new SerialNumber();
     Hardware = "";
     Firmware = new Firmware();
 }
示例#13
0
        public void TestGetSubsystem()
        {
            SerialNumber serial = new SerialNumber("01300000000000000000000000000001");
            Firmware fw = new Firmware(0x3, 1, 2, 3);
            Subsystem ss = new Subsystem(fw.GetSubsystemCode(new SerialNumber()));

            Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect.");
        }
示例#14
0
        public void TestEqualEqual()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);
            byte[] encoded = fw.Encode();
            Firmware fw1 = new Firmware(encoded);

            Assert.AreEqual(true, fw1 == fw, "== is incorrect.");
        }
示例#15
0
        public void TestGetSubsystemVersion()
        {
            SerialNumber serial = new SerialNumber("01300000000000000000000000000001");
            Firmware fw = new Firmware(Subsystem.SUB_600KHZ_4BEAM_20DEG_PISTON_3, 0, 2, 3);
            Subsystem ss = new Subsystem(fw.GetSubsystemCode(serial));

            Assert.AreEqual(ss, fw.GetSubsystem(serial), "GetSubsystem is incorrect.");
        }
示例#16
0
        public void GetList()
        {
            List <ushort> list = Firmware.FirmwareVersionList();

            Assert.AreEqual(255, list.Count(), "List is incorrect.");
        }
示例#17
0
        public void TestNotEqual()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);
            Firmware fw1 = new Firmware(0x3, 2, 2, 3);

            Assert.AreEqual(false, fw1 == fw, "== is incorrect.");
            Assert.AreEqual(true, fw1 != fw, "!= is incorrect.");
        }
示例#18
0
        public void TestToString()
        {
            Firmware fw = new Firmware(Convert.ToByte('3'), 1, 2, 3);

            Assert.AreEqual("1.2.3 - 3", fw.ToString(), "ToString is incorrect.");
        }
示例#19
0
 public void TestToString()
 {
     Firmware fw = new Firmware( Convert.ToByte('3'), 1, 2, 3);
     Assert.AreEqual("1.2.3 - 3", fw.ToString(), "ToString is incorrect.");
 }
示例#20
0
        public void TestConstructor3()
        {
            Firmware fw = new Firmware(0x3, 1, 2, 3);

            Assert.AreEqual(1, fw.FirmwareMajor, "Major is incorrect.");
            Assert.AreEqual(2, fw.FirmwareMinor, "Minor is incorrect.");
            Assert.AreEqual(3, fw.FirmwareRevision, "Revision is incorrect.");
            Assert.AreEqual(0x3, fw.GetSubsystemCode(new SerialNumber()), "Subsystem Code is incorrect.");

            byte[] encoded = fw.Encode();

            Assert.AreEqual(4, encoded.Length, "Encoded length is incorrect.");
            Assert.AreEqual(1, encoded[Firmware.MAJOR_START], "Encoded Major is incorrect.");
            Assert.AreEqual(2, encoded[Firmware.MINOR_START], "Encoded Minor is incorrect.");
            Assert.AreEqual(3, encoded[Firmware.REVISION_START], "Encoded Revision is incorrect.");
            Assert.AreEqual(0x3, encoded[Firmware.SUBSYSTEM_START], "Encoded Subsystem Code is incorrect.");

            Firmware fw1 = new Firmware(encoded);

            Assert.AreEqual(1, fw1.FirmwareMajor, "FW1 Major is incorrect.");
            Assert.AreEqual(2, fw1.FirmwareMinor, "FW1 Minor is incorrect.");
            Assert.AreEqual(3, fw1.FirmwareRevision, "FW1 Revision is incorrect.");
            Assert.AreEqual(0x3, fw1.GetSubsystemCode(new SerialNumber()), "FW1 Subsystem Code is incorrect.");
        }
示例#21
0
        public void TestEncodeDecode()
        {
            Firmware fw = new Firmware(0x1, 5, 2, 3);
            byte[] encoded = fw.Encode();

            Firmware fw1 = new Firmware(encoded);

            Assert.AreEqual(5, fw1.FirmwareMajor, "FW1 Major is incorrect.");
            Assert.AreEqual(2, fw1.FirmwareMinor, "FW1 Minor is incorrect.");
            Assert.AreEqual(3, fw1.FirmwareRevision, "FW1 Revision is incorrect.");
            Assert.AreEqual(0x1, fw1.GetSubsystemCode(new SerialNumber()), "FW1 Subsystem Code is incorrect.");
            Assert.AreEqual(fw1, fw, "Firmware is not ==");
            Assert.AreEqual(true, fw1 == fw, "== is incorrect.");
        }