Example #1
0
 public virtual void TestShouldConvertTagToBytesAndBackToEquivalentTag()
 {
     ID3v1 id3tag = new ID3v1Tag();
     id3tag.SetTrack("5");
     id3tag.SetArtist("ARTIST");
     id3tag.SetTitle("TITLE");
     id3tag.SetAlbum("ALBUM");
     id3tag.SetYear("1997");
     id3tag.SetGenre(13);
     id3tag.SetComment("COMMENT");
     byte[] data = id3tag.ToBytes();
     ID3v1 id3tagCopy = new ID3v1Tag(data);
     Assert.AreEqual(id3tag, id3tagCopy);
 }
Example #2
0
 public virtual void TestShouldGenerateValidTagBufferWithHighGenreAndTrackNumber()
 {
     ID3v1Tag id3v1tag = new ID3v1Tag();
     id3v1tag.SetTitle("TITLE");
     id3v1tag.SetArtist("ARTIST");
     id3v1tag.SetAlbum("ALBUM");
     id3v1tag.SetYear("2001");
     id3v1tag.SetComment("COMMENT");
     id3v1tag.SetTrack("254");
     id3v1tag.SetGenre(unchecked((int)(0x8d)));
     byte[] expectedBuffer = BufferTools.StringToByteBuffer(VALID_TAG_WITH_WHITESPACE, 0, VALID_TAG_WITH_WHITESPACE.Length);
     TestHelper.ReplaceSpacesWithNulls(expectedBuffer);
     expectedBuffer[expectedBuffer.Length - 3] = unchecked((int)(0x00));
     expectedBuffer[expectedBuffer.Length - 2] = unchecked((byte)(-unchecked((int)(0x02))));
     // 254 as a signed byte
     expectedBuffer[expectedBuffer.Length - 1] = unchecked((byte)(-unchecked((int)(0x73))));
     // 0x8D as a signed byte
     Assert.IsTrue(Arrays.Equals(expectedBuffer, id3v1tag.ToBytes()));
 }