Пример #1
0
 public virtual void TestShouldExtractMaximumLengthFieldsFromValid10Tag()
 {
     byte[] buffer = BufferTools.StringToByteBuffer(VALID_TAG, 0, VALID_TAG.Length);
     buffer[buffer.Length - 1] = unchecked((byte)(-unchecked((int)(0x6D))));
     // 0x93 as a signed byte
     ID3v1Tag id3v1tag = new ID3v1Tag(buffer);
     Assert.AreEqual("TITLE1234567890123456789012345", id3v1tag.GetTitle());
     Assert.AreEqual("ARTIST123456789012345678901234", id3v1tag.GetArtist());
     Assert.AreEqual("ALBUM1234567890123456789012345", id3v1tag.GetAlbum());
     Assert.AreEqual("2001", id3v1tag.GetYear());
     Assert.AreEqual("COMMENT12345678901234567890123", id3v1tag.GetComment());
     Assert.AreEqual(null, id3v1tag.GetTrack());
     Assert.AreEqual(unchecked((int)(0x93)), id3v1tag.GetGenre());
     Assert.AreEqual("Synthpop", id3v1tag.GetGenreDescription());
 }
Пример #2
0
 public virtual void TestShouldExtractMaximumLengthFieldsFromValid11Tag()
 {
     byte[] buffer = BufferTools.StringToByteBuffer(VALID_TAG, 0, VALID_TAG.Length);
     buffer[buffer.Length - 3] = unchecked((int)(0x00));
     buffer[buffer.Length - 2] = unchecked((int)(0x01));
     buffer[buffer.Length - 1] = unchecked((int)(0x0D));
     ID3v1Tag id3v1tag = new ID3v1Tag(buffer);
     Assert.AreEqual("TITLE1234567890123456789012345", id3v1tag.GetTitle());
     Assert.AreEqual("ARTIST123456789012345678901234", id3v1tag.GetArtist());
     Assert.AreEqual("ALBUM1234567890123456789012345", id3v1tag.GetAlbum());
     Assert.AreEqual("2001", id3v1tag.GetYear());
     Assert.AreEqual("COMMENT123456789012345678901", id3v1tag.GetComment());
     Assert.AreEqual("1", id3v1tag.GetTrack());
     Assert.AreEqual(unchecked((int)(0x0d)), id3v1tag.GetGenre());
     Assert.AreEqual("Pop", id3v1tag.GetGenreDescription());
 }
Пример #3
0
 public virtual void TestShouldExtractTrimmedFieldsFromValid11TagWithNullspace()
 {
     byte[] buffer = BufferTools.StringToByteBuffer(VALID_TAG_WITH_WHITESPACE, 0, VALID_TAG_WITH_WHITESPACE.Length);
     TestHelper.ReplaceSpacesWithNulls(buffer);
     buffer[buffer.Length - 3] = unchecked((int)(0x00));
     buffer[buffer.Length - 2] = unchecked((int)(0x01));
     buffer[buffer.Length - 1] = unchecked((int)(0x0D));
     ID3v1Tag id3v1tag = new ID3v1Tag(buffer);
     Assert.AreEqual("TITLE", id3v1tag.GetTitle());
     Assert.AreEqual("ARTIST", id3v1tag.GetArtist());
     Assert.AreEqual("ALBUM", id3v1tag.GetAlbum());
     Assert.AreEqual("2001", id3v1tag.GetYear());
     Assert.AreEqual("COMMENT", id3v1tag.GetComment());
     Assert.AreEqual("1", id3v1tag.GetTrack());
     Assert.AreEqual(unchecked((int)(0x0d)), id3v1tag.GetGenre());
     Assert.AreEqual("Pop", id3v1tag.GetGenreDescription());
 }
Пример #4
0
 public virtual void TestShouldReadTagFieldsFromMp3()
 {
     byte[] buffer = TestHelper.LoadFile("Resources/v1andv23tags.mp3");
     byte[] tagBuffer = BufferTools.CopyBuffer(buffer, buffer.Length - ID3v1Tag.TAG_LENGTH, ID3v1Tag.TAG_LENGTH);
     ID3v1 id3tag = new ID3v1Tag(tagBuffer);
     Assert.AreEqual("1", id3tag.GetTrack());
     Assert.AreEqual("ARTIST123456789012345678901234", id3tag.GetArtist());
     Assert.AreEqual("TITLE1234567890123456789012345", id3tag.GetTitle());
     Assert.AreEqual("ALBUM1234567890123456789012345", id3tag.GetAlbum());
     Assert.AreEqual("2001", id3tag.GetYear());
     Assert.AreEqual(unchecked((int)(0x0d)), id3tag.GetGenre());
     Assert.AreEqual("Pop", id3tag.GetGenreDescription());
     Assert.AreEqual("COMMENT123456789012345678901", id3tag.GetComment());
 }