private void button1_Click(object sender, EventArgs e) { byte commandAddr = (byte)((comboBox1.Text == "X轴") ? 0x00 : 0x01); byte value = (byte)((comboBox2.Text == "低电平") ? 0x00 : 0x01); CmdInOut ci = new CmdInOut(); addrc = ci.GetIOCmd(commandAddr, value); richTextBox1.Text = DataChange.byteToHexStr(addrc); }
public void GetIOCmdTest() { CmdInOut cf = new CmdInOut(); byte[] ret = cf.GetIOCmd(0x00, 0x01); Assert.AreEqual(ret.Count(), 7); Assert.AreEqual(ret[6], 0xC5); Assert.AreEqual(ret[0], 0xAA); Assert.AreEqual(ret[1], 0x06); Assert.AreEqual(ret[2], 0x01); Assert.AreEqual(ret[3], 0xC3); }