public void TestSetStringEvenLengthPadding() { var defCharSet = new byte[] { 0x4D, 0x4F, 0x4E, 0x4F, 0x43, 0x48, 0x52, 0x4F, 0x4D, 0x45, 0x32 }; var scsH31 = new byte[] { 65, 0x59, 0x61, 0x6D, 0x61, 0x64, 0x61, 0x5E, 0x54, 0x61, 0x72, 0x6F, 0x75, 0x3D, 0x1B, 0x24, 0x42, 0x3B, 0x33, 0x45, 0x44, 0x1B, 0x28, 0x42, 0x5E, 0x1B, 0x24, 0x42, 0x42, 0x40, 0x4F, 0x3A, 0x1B, 0x28, 0x42, 0x3D, 0x1B, 0x24, 0x42, 0x24, 0x64, 0x24, 0x5E, 0x24, 0x40, 0x1B, 0x28, 0x42, 0x5E, 0x1B, 0x24, 0x42, 0x24, 0x3F, 0x24, 0x6D, 0x24, 0x26, 0x1B, 0x28, 0x42 }; using (var bb = new TestByteBuffer()) { bb.SetString(@"MONOCHROME2", 0x20); Assert.AreEqual(0, bb.StreamPosition, @"SetString - StreamPosition - Default Character Set"); AssertAreEqual(defCharSet, 0, bb.DumpTestData(), 0, defCharSet.Length, @"SetString - Default Character Set"); AssertAreEqual(new byte[] { 0x20 }, 0, bb.DumpTestData(), defCharSet.Length, 1, @"SetString - Default Character Set - padding"); } using (var bb = new TestByteBuffer { SpecificCharacterSet = @"\ISO 2022 IR 87" }) { bb.SetString(@"AYamada^Tarou=山田^太郎=やまだ^たろう", 0x20); Assert.AreEqual(0, bb.StreamPosition, @"SetString - StreamPosition - H31 Example (\ISO 2022 IR 87)"); AssertAreEqual(scsH31, 0, bb.DumpTestData(), 0, scsH31.Length, @"SetString - H31 Example (\ISO 2022 IR 87)"); AssertAreEqual(new byte[] { 0x20 }, 0, bb.DumpTestData(), scsH31.Length, 1, @"SetString - H31 Example (\ISO 2022 IR 87) - padding"); } }