本文整理汇总了C#中Subsystem.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Subsystem.ToString方法的具体用法?C# Subsystem.ToString怎么用?C# Subsystem.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subsystem
的用法示例。
在下文中一共展示了Subsystem.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestConstructor
public void TestConstructor()
{
// Create a serial number
string serialStr = "01300000000000000000000000000001";
SerialNumber serialNum = new SerialNumber(serialStr);
// Test the serial number
Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString()));
Assert.AreEqual(1, serialNum.SubSystemsDict.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsDict.Count));
Subsystem ss = new Subsystem("3", 0);
Assert.AreEqual(ss, serialNum.SubSystemsDict[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsDict[0].ToString()));
Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber));
}
示例2: Test150KhzFrequency
public void Test150KhzFrequency()
{
// Create a serial number
string serialStr = "01K00000000000000000000000000001";
SerialNumber serialNum = new SerialNumber(serialStr);
// Test the serial number
Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString()));
Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count));
// Upper case K
Subsystem ss = new Subsystem("K", 0);
Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString()));
// Lower case k
Subsystem ss1 = new Subsystem("k", 0);
Assert.AreNotEqual(ss1, serialNum.SubSystemsList[0], string.Format("Subsystems should not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[0].ToString()));
Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber));
}
示例3: TestAddSubsystem
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()));
}
示例4: TestSerialJSON
public void TestSerialJSON()
{
// Create a serial number
string serialStr = "01300000000000000000000000000001";
SerialNumber serial = new SerialNumber(serialStr);
// Convert to JSON and back
string json = Newtonsoft.Json.JsonConvert.SerializeObject(serial); // Serialize object to JSON
SerialNumber serialNum = Newtonsoft.Json.JsonConvert.DeserializeObject<SerialNumber>(json); // Deserialize the JSON
// Test the serial number
Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString()));
Assert.AreEqual(1, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", serialNum.SubSystemsList.Count));
Subsystem ss = new Subsystem("3", 0);
Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString()));
Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber));
}
示例5: TestRemoveSubsystemWrongIndex
public void TestRemoveSubsystemWrongIndex()
{
// Create a serial number
string serialStr = "01345600000000000000000000000001";
SerialNumber serial = new SerialNumber(serialStr);
Subsystem ss = new Subsystem("4", 4);
serial.RemoveSubsystem(ss);
Assert.AreEqual(3, serial.SubSystemsList.Count, "Subsystem count is incorrect.");
// Subsystem type 3
Subsystem ss0 = new Subsystem("3", 0);
Assert.AreEqual(ss0, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss0.ToString(), serial.SubSystemsList[0].ToString()));
// Subsystem type 2
Subsystem ss2 = new Subsystem("5", 1);
Assert.AreEqual(ss2, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serial.SubSystemsList[1].ToString()));
}
示例6: TestMultipleSubsystems
public void TestMultipleSubsystems()
{
// Create a serial number
string serialStr = "01KBXV00000000000000000000000001";
SerialNumber serialNum = new SerialNumber(serialStr);
// Test the serial number
Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString()));
Assert.AreEqual(4, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 4 {0}", serialNum.SubSystemsList.Count));
// Upper case K
Subsystem ss = new Subsystem("K", 0);
Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString()));
// Lower case K
Subsystem ssNot = new Subsystem("k", 0);
Assert.AreNotEqual(ssNot, serialNum.SubSystemsList[0], string.Format("Subsystems should not match {0} {1}", ssNot.ToString(), serialNum.SubSystemsList[0].ToString()));
Subsystem ss1 = new Subsystem("B", 1);
Assert.AreEqual(ss1, serialNum.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[1].ToString()));
Subsystem ss2 = new Subsystem("X", 2);
Assert.AreEqual(ss2, serialNum.SubSystemsList[2], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serialNum.SubSystemsList[2].ToString()));
Subsystem ss3 = new Subsystem("V", 3);
Assert.AreEqual(ss3, serialNum.SubSystemsList[3], string.Format("Subsystems do not match {0} {1}", ss3.ToString(), serialNum.SubSystemsList[3].ToString()));
Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber));
}
示例7: TestDualFrequency
public void TestDualFrequency()
{
// Create a serial number
string serialStr = "01340000000000000000000000000001";
SerialNumber serialNum = new SerialNumber(serialStr);
// Test the serial number
Assert.AreEqual(serialStr, serialNum.ToString(), string.Format("Serial number strings did not match {0} {1}", serialStr, serialNum.ToString()));
Assert.AreEqual(2, serialNum.SubSystemsList.Count, string.Format("Number of SubSystems did not match 2 {0}", serialNum.SubSystemsList.Count));
Subsystem ss = new Subsystem("3", 0);
Assert.AreEqual(ss, serialNum.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serialNum.SubSystemsList[0].ToString()));
Subsystem ss1 = new Subsystem("4", 1);
Assert.AreEqual(ss1, serialNum.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serialNum.SubSystemsList[1].ToString()));
Assert.AreEqual(1, serialNum.SystemSerialNumber, string.Format("Serial numbers do not match {0} {1}", 1, serialNum.SystemSerialNumber));
}
示例8: TestChangeSubsystemsBad
public void TestChangeSubsystemsBad()
{
// Create a serial number
string serialStr = "01300000000000000000000000000001";
SerialNumber serial = new SerialNumber(serialStr);
serial.SubSystems = "34000000000000099";
Assert.AreEqual("300000000000000", serial.SubSystems, "Subsystem String is incorrect.");
Assert.AreEqual(1, 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()));
}
示例9: TestChangeSubsystems1
public void TestChangeSubsystems1()
{
// Create a serial number
string serialStr = "01300000000000000000000000000001";
SerialNumber serial = new SerialNumber(serialStr);
serial.SubSystems = "123456789ABCDEf";
Assert.AreEqual("123456789ABCDEf", serial.SubSystems, "Subsystem String is incorrect.");
Assert.AreEqual(15, serial.SubSystemsList.Count, "Subsystem Dict Count is incorrect.");
// Subsystem type 1
Subsystem ss = new Subsystem("1", 0);
Assert.AreEqual(ss, serial.SubSystemsList[0], string.Format("Subsystems do not match {0} {1}", ss.ToString(), serial.SubSystemsList[0].ToString()));
// Subsystem type 2
Subsystem ss1 = new Subsystem("2", 1);
Assert.AreEqual(ss1, serial.SubSystemsList[1], string.Format("Subsystems do not match {0} {1}", ss1.ToString(), serial.SubSystemsList[1].ToString()));
// Subsystem type 3
Subsystem ss2 = new Subsystem("3", 2);
Assert.AreEqual(ss2, serial.SubSystemsList[2], string.Format("Subsystems do not match {0} {1}", ss2.ToString(), serial.SubSystemsList[2].ToString()));
// Subsystem type 4
Subsystem ss3 = new Subsystem("4", 3);
Assert.AreEqual(ss3, serial.SubSystemsList[3], string.Format("Subsystems do not match {0} {1}", ss3.ToString(), serial.SubSystemsList[3].ToString()));
// Subsystem type 5
Subsystem ss4 = new Subsystem("5", 4);
Assert.AreEqual(ss4, serial.SubSystemsList[4], string.Format("Subsystems do not match {0} {1}", ss4.ToString(), serial.SubSystemsList[4].ToString()));
// Subsystem type 6
Subsystem ss5 = new Subsystem("6", 5);
Assert.AreEqual(ss5, serial.SubSystemsList[5], string.Format("Subsystems do not match {0} {1}", ss5.ToString(), serial.SubSystemsList[5].ToString()));
// Subsystem type 7
Subsystem ss6 = new Subsystem("7", 6);
Assert.AreEqual(ss6, serial.SubSystemsList[6], string.Format("Subsystems do not match {0} {1}", ss6.ToString(), serial.SubSystemsList[6].ToString()));
// Subsystem type 8
Subsystem ss7 = new Subsystem("8", 7);
Assert.AreEqual(ss7, serial.SubSystemsList[7], string.Format("Subsystems do not match {0} {1}", ss7.ToString(), serial.SubSystemsList[7].ToString()));
// Subsystem type 9
Subsystem ss8 = new Subsystem("9", 8);
Assert.AreEqual(ss8, serial.SubSystemsList[8], string.Format("Subsystems do not match {0} {1}", ss8.ToString(), serial.SubSystemsList[8].ToString()));
// Subsystem type A
Subsystem ss9 = new Subsystem("A", 9);
Assert.AreEqual(ss9, serial.SubSystemsList[9], string.Format("Subsystems do not match {0} {1}", ss9.ToString(), serial.SubSystemsList[9].ToString()));
// Subsystem type B
Subsystem ssB = new Subsystem("B", 10);
Assert.AreEqual(ssB, serial.SubSystemsList[10], string.Format("Subsystems do not match {0} {1}", ssB.ToString(), serial.SubSystemsList[10].ToString()));
// Subsystem type C
Subsystem ssC = new Subsystem("C", 11);
Assert.AreEqual(ssC, serial.SubSystemsList[11], string.Format("Subsystems do not match {0} {1}", ssC.ToString(), serial.SubSystemsList[11].ToString()));
// Subsystem type D
Subsystem ssD = new Subsystem("D", 12);
Assert.AreEqual(ssD, serial.SubSystemsList[12], string.Format("Subsystems do not match {0} {1}", ssD.ToString(), serial.SubSystemsList[12].ToString()));
// Subsystem type E
Subsystem ssE = new Subsystem("E", 13);
Assert.AreEqual(ssE, serial.SubSystemsList[13], string.Format("Subsystems do not match {0} {1}", ssE.ToString(), serial.SubSystemsList[13].ToString()));
// Subsystem type f
Subsystem ssf = new Subsystem("f", 14);
Assert.AreEqual(ssf, serial.SubSystemsList[14], string.Format("Subsystems do not match {0} {1}", ssf.ToString(), serial.SubSystemsList[14].ToString()));
}