コード例 #1
0
        public void ConverterISO88591_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = Encoding.Default,
                                    Content = "ABCD",
                                    Descriptor = {Id = "TALB"}
                                };

            RawFrame rawFrame = textFrame.Convert(TagVersion.Id3V23);

            Assert.AreEqual(rawFrame.Id, "TALB");
            Assert.AreEqual(rawFrame.Payload[0], 0); // ISO_8859 coding
            Assert.AreEqual(rawFrame.Payload.Count, 5);
        }
コード例 #2
0
        public void ConverterUTF16_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = Encoding.Unicode,
                                    Content = "ABCD",
                                    Descriptor = {Id = "TALB"}
                                };

            RawFrame rawFrame = textFrame.Convert(TagVersion.Id3V23);

            Assert.AreEqual(rawFrame.Id, "TALB");
            Assert.AreEqual(rawFrame.Payload[0], 1); // UTF 16
            Assert.AreEqual(rawFrame.Payload[1], 0xFF); // BOM 1
            Assert.AreEqual(rawFrame.Payload[2], 0xFE); // BOM 2
            Assert.AreEqual(rawFrame.Payload.Count, 11);
        }
コード例 #3
0
        public void ConverterUTF16BE_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = new UnicodeEncoding(true, false),
                                    Content = "ABCD",
                                    Descriptor = {Id = "TALB"}
                                };

            RawFrame rawFrame = textFrame.Convert(TagVersion.Id3V23);

            Assert.AreEqual(rawFrame.Id, "TALB");

            var refBytes = new byte[]
                               {
                                   0x02, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00, 0x44
                               };

            Assert.IsTrue(ComparePayload(rawFrame.Payload, refBytes));
        }