Ejemplo n.º 1
0
        public void ConverterISO88591_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = TextEncodingType.ISO_8859_1,
                                    Content = "ABCD",
                                    Descriptor = {ID = "TALB"}
                                };

            var rawFrame = textFrame.Convert();

            Assert.AreEqual(rawFrame.ID, "TALB");
            Assert.AreEqual(rawFrame.Payload[0], 0); // ISO_8859 coding
            Assert.AreEqual(rawFrame.Payload.Length, 5);
        }
Ejemplo n.º 2
0
        public void ConverterISO88591_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = Encoding.Default,
                                    Content = "ABCD",
                                    Descriptor = {ID = "TALB"}
                                };

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

            Assert.AreEqual(rawFrame.ID, "TALB");
            Assert.AreEqual(rawFrame.Payload[0], 0); // ISO_8859 coding
            Assert.AreEqual(rawFrame.Payload.Length, 5);
        }
Ejemplo n.º 3
0
        public void ConverterUTF16_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = TextEncodingType.UTF16,
                                    Content = "ABCD",
                                    Descriptor = {ID = "TALB"}
                                };

            var rawFrame = textFrame.Convert();

            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.Length, 11);
        }
Ejemplo n.º 4
0
        public void ConverterUTF16BE_Test()
        {
            var textFrame = new TextFrame
                                {
                                    TextEncoding = TextEncodingType.UTF16_BE,
                                    Content = "ABCD",
                                    Descriptor = {ID = "TALB"}
                                };

            var rawFrame = textFrame.Convert();

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

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

            Assert.IsTrue(ComparePayload(rawFrame.Payload, refBytes));
        }
Ejemplo n.º 5
0
        public void ConverterUTF16BE_Test()
        {
            var textFrame = new TextFrame
                                {
									TextEncoding = new UnicodeEncoding(true, false),
                                    Content = "ABCD",
                                    Descriptor = {ID = "TALB"}
                                };

            var 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));
        }