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."); }
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."); }
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."); }
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."); }
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."); }
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."); }
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."); }