public void ConvertsText() { string testString = "TestString019! "; var parser = new StringPacketInterpreter(); string result = parser.InterpretPacket((new UTF8Encoding()).GetBytes(testString)); Assert.Equal(testString, result); }
public void ConvertsUnprintables() { var vals = new byte[0, 1, 4, 7, 0x7F]; foreach (byte v in vals) { string testString = new string(new [] { (char)v }); var parser = new StringPacketInterpreter(); string result = parser.InterpretPacket((new UTF8Encoding()).GetBytes(testString)); Assert.Equal(string.Format("[{0:X2}]", v), result); } }
public void ConvertsEmptyArray() { var parser = new StringPacketInterpreter(); string result = parser.InterpretPacket(new byte[0]); Assert.Equal(string.Empty, result); }