Esempio n. 1
0
        public void TestGetString()
        {
            var scsDefault = new byte[]
            {
                0x4D, 0x4F, 0x4E, 0x4F, 0x43, 0x48, 0x52, 0x4F,
                0x4D, 0x45, 0x32
            };

            var scsH31 = new byte[]
            {
                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(scsDefault))
            {
                Assert.AreEqual(@"MONOCHROME2", bb.GetString(), @"GetString - Default Character Set");
                Assert.AreEqual(0, bb.StreamPosition, @"GetString - StreamPosition - Default Character Set");
            }

            using (var bb = new TestByteBuffer(scsH31)
            {
                SpecificCharacterSet = @"\ISO 2022 IR 87"
            })
            {
                Assert.AreEqual(@"Yamada^Tarou=山田^太郎=やまだ^たろう", bb.GetString(), @"GetString - H31 Example (\ISO 2022 IR 87)");
                Assert.AreEqual(0, bb.StreamPosition, @"GetString - StreamPosition - H31 Example (\ISO 2022 IR 87)");
            }
        }