示例#1
0
        public void ValidationOKTest()
        {
            /*
             *  T___
             *  TXXX
             *  WXXX
             *  APIC
             */

            var tagContainer = new TagContainerV3();
            tagContainer.Tag.SetExtendedHeader(0, false);
            tagContainer.Tag.SetHeaderOptions(false, false, false);

            var textFrame = new TextFrame("TALB", "My Albun", Encoding.Default);
            var userDefineTextFrame = new UserDefinedTextFrame("my comment", "so", Encoding.Default);
            var linkFrame = new UserDefinedUrlLinkFrame("Id3Tag", "Id3Tag.codeplex.com", Encoding.Default);
            var pictureFrame = new PictureFrame(
                Encoding.Default,
                "image/jpeg",
                "la",
                PictureType.Other,
                new byte[] {0x11, 0x12, 0x13, 0x14});

            tagContainer.Add(textFrame);
            tagContainer.Add(userDefineTextFrame);
            tagContainer.Add(linkFrame);
            tagContainer.Add(pictureFrame);

            WriteTagContainer(tagContainer);

            // OK... passed!
        }
        public void ConverterISO88591_Test()
        {
            var frame = new UserDefinedUrlLinkFrame();

            frame.Description = "ABCD";
            frame.TextEncoding = Encoding.Default;
            frame.Url = "EFGH";
            frame.Descriptor.Id = "WXXX";

            var refPayloadBytes = new byte[] {0x00, 0x41, 0x42, 0x43, 0x44, 0x00, 0x45, 0x46, 0x47, 0x48};
            RawFrame rawFrame = frame.Convert(TagVersion.Id3V23);
            Assert.AreEqual(rawFrame.Id, "WXXX");
            Assert.AreEqual(rawFrame.Payload, refPayloadBytes);
        }
        public void CreateTest()
        {
            var frame = new UserDefinedUrlLinkFrame("ABCD", "EFGH", Encoding.Unicode);

            Assert.AreEqual(frame.Descriptor.Id, "WXXX");
            Assert.AreEqual(frame.Description, "ABCD");
            Assert.AreEqual(frame.Url, "EFGH");
            Assert.AreEqual(frame.TextEncoding.CodePage, Encoding.Unicode.CodePage);
        }