public void KeyValuePacket_Parse_NullValue() { byte[] input = new byte[] { 0x4B, 0x56, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xB4, 0xA9, 0xAF, 0xFE }; KeyValuePacket kvp = KeyValuePacket.Parse(input); Assert.AreEqual(kvp.Key.Length, 0); Assert.AreEqual(kvp.GetValue(), null); }
public void KeyValuePacket_Parse_NullKeyValue() { byte[] input = new byte[] { 0x4B, 0x56, 0x50, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x4B, 0x56, 0x50, 0x01 }; KeyValuePacket kvp = KeyValuePacket.Parse(input); Assert.AreEqual(kvp.Key, null); Assert.AreEqual(kvp.GetValue(), null); }
public void KeyValuePacket_ToArray_NullValue() { KeyValuePacket kvp = new KeyValuePacket("", null); byte[] result = kvp.ToArray(); string resultString = System.BitConverter.ToString(result); Assert.AreEqual("4B-56-50-01-00-00-00-00-FF-FF-FF-FF-B4-A9-AF-FE", resultString); }
public void KeyValuePacket_ToArray() { KeyValuePacket kvp = new KeyValuePacket("XXX", new byte[] { 0, 1, 2, 3 }); byte[] result = kvp.ToArray(); string resultString = System.BitConverter.ToString(result); Assert.AreEqual("4B-56-50-01-00-00-00-03-00-00-00-04-4B-52-53-01-58-58-58-00-01-02-03", resultString); }
public void KeyValuePacket_Parse() { byte[] input = new byte[] { 0x4B, 0x56, 0x50, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x04, 0x4B, 0x52, 0x53, 0x01, 0x58, 0x58, 0x58, 0x00, 0x01, 0x02, 0x03 }; KeyValuePacket kvp = KeyValuePacket.Parse(input); Assert.AreEqual(kvp.Key, "XXX"); Assert.AreEqual(kvp.GetValue()[0], 0); Assert.AreEqual(kvp.GetValue()[1], 1); Assert.AreEqual(kvp.GetValue()[2], 2); Assert.AreEqual(kvp.GetValue()[3], 3); }