public void ByteArrayToAsciiString() { var input = new byte[] { 40, 41, 42, 43 }; var conv = new AsciiPayloadConverter(); var output = (string)conv.ConvertFromBytes(input); Assert.Equal<int>(input.Length, output.Length); for (int i = 0; i < input.Length; i++) { Assert.Equal<byte>(input[i], (byte)output[i]); } }
public void ByteArrayToAsciiString() { var input = new byte[] { 40, 41, 42, 43 }; var conv = new AsciiPayloadConverter(); var output = (string)conv.ConvertFromBytes(input); Assert.Equal <int>(input.Length, output.Length); for (int i = 0; i < input.Length; i++) { Assert.Equal <byte>(input[i], (byte)output[i]); } }
public void AsciiStringToByteArray() { var testString = "testStringA-Z,1-9,a-z"; var conv = new AsciiPayloadConverter(); byte[] bytes = conv.ConvertToBytes(testString); Assert.Equal<int>(testString.Length, bytes.Length); for (int i = 0; i < testString.Length; i++) { Assert.Equal<byte>((byte)testString[i], bytes[i]); } }
public void AsciiStringToByteArray() { var testString = "testStringA-Z,1-9,a-z"; var conv = new AsciiPayloadConverter(); byte[] bytes = conv.ConvertToBytes(testString); Assert.Equal <int>(testString.Length, bytes.Length); for (int i = 0; i < testString.Length; i++) { Assert.Equal <byte>((byte)testString[i], bytes[i]); } }