public void TestAddSubsystem() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); Subsystem ss1 = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 1); serial.AddSubsystem(ss1); Assert.AreEqual(2, serial.SubSystemsList.Count, "Dictionary count is incorrect."); Assert.AreEqual("320000000000000", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(2, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 3 Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString())); }
/// <summary> /// Add a subsystem to the serial number. Then /// update the removed the selected subsystem from the list /// and select a new default. /// </summary> /// <param name="ss">Subsystem to add.</param> public void AddSubsystem(Subsystem ss) { _SerialNumber.AddSubsystem(ss); RTI.SubsystemList.SubsystemCodeDesc subsysDesc = new RTI.SubsystemList.SubsystemCodeDesc(ss.Code, Subsystem.DescString(ss.Code)); if (ListOfSubsystems.Contains(subsysDesc)) { ListOfSubsystems.Remove(subsysDesc); } // Set something new to the selected subsystem if (ListOfSubsystems.Count > 0) { SelectedSubsystem = ListOfSubsystems.First(); } // Update the Subsystem and Serial number string this.NotifyOfPropertyChange(() => this.Subsystems); this.NotifyOfPropertyChange(() => this.SerialNumStr); // Send event to update Serial number UpdateSerialNumberEvent(); }
public void TestAddSubsystem() { // Create a serial number string serialStr = "01300000000000000000000000000001"; SerialNumber serial = new SerialNumber(serialStr); Subsystem ss1 = new Subsystem(Subsystem.SUB_1_2MHZ_4BEAM_20DEG_PISTON_2, 1); serial.AddSubsystem(ss1); Assert.AreEqual(2, serial.SubSystemsList.Count, "Dictionary count is incorrect."); Assert.AreEqual("320000000000000", serial.SubSystems, "Subsystem String is incorrect."); Assert.AreEqual(2, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect."); // Subsystem type 3 Subsystem ss = new Subsystem("3", 0); Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString())); // Subsystem type 2 Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString())); }