?????????????????????????????????д??????????
[TestClass]
public class ByteStringTest {
[TestMethod]
public void ConverterToBytes() {
string input = "30d9132169211a45";
Byte[] bytes = ByteString.ConverterToBytes(input);
Assert.IsTrue(bytes.Length == input.Length / 2);
Assert.IsTrue(bytes[0] == 0x30);
Assert.IsTrue(bytes[1] == 0xd9);
Assert.IsTrue(bytes[2] == 0x13);
Assert.IsTrue(bytes[3] == 0x21);
Assert.IsTrue(bytes[4] == 0x69);
Assert.IsTrue(bytes[5] == 0x21);
Assert.IsTrue(bytes[6] == 0x1a);
Assert.IsTrue(bytes[7] == 0x45);
input = "30-D9-13-21-69-21-1A-45";
bytes = ByteString.ConverterToBytes(input);
Assert.IsTrue(bytes.Length == 8);
Assert.IsTrue(bytes[0] == 0x30);
Assert.IsTrue(bytes[1] == 0xd9);
Assert.IsTrue(bytes[2] == 0x13);
Assert.IsTrue(bytes[3] == 0x21);
Assert.IsTrue(bytes[4] == 0x69);
Assert.IsTrue(bytes[5] == 0x21);
Assert.IsTrue(bytes[6] == 0x1a);
Assert.IsTrue(bytes[7] == 0x45);
input = "30 D9 13 21 69 21 1A 45";
bytes = ByteString.ConverterToBytes(input);
Assert.IsTrue(bytes.Length == 8);
Assert.IsTrue(bytes[0] == 0x30);
Assert.IsTrue(bytes[1] == 0xd9);
Assert.IsTrue(bytes[2] == 0x13);
Assert.IsTrue(bytes[3] == 0x21);
Assert.IsTrue(bytes[4] == 0x69);
Assert.IsTrue(bytes[5] == 0x21);
Assert.IsTrue(bytes[6] == 0x1a);
Assert.IsTrue(bytes[7] == 0x45);
}
}
??????????????????????????Assert.IsTrue()?????У??????False??????VS?л??????????????????????????
?????????[TestClass]?????????????????????public???????????浥?????????????????????[TestMethod]?????????public??????
??????Visual Studio???滹????????????Ctrl + R??A??????????е???????????????????????ж?????????????λ???????????????