public virtual void TestShouldConvertFrameDataWithNoDescriptionToBytesAndBackToEquivalentObject() { ID3v2UrlFrameData frameData = new ID3v2UrlFrameData(false, new EncodedText(string.Empty), TEST_URL); byte[] bytes = frameData.ToBytes(); byte[] expectedBytes = new byte[] { 0, 0, (byte)('h'), (byte)('t'), (byte)('t'), (byte)('p'), (byte)(':'), (byte)('/'), (byte)('/'), (byte)('A'), (byte)('B'), (byte )('C'), (byte)('D'), (byte)('E'), (byte)('F'), (byte)('G'), (byte)('H'), (byte)( 'I'), (byte)('J'), (byte)('K'), (byte)('L'), (byte)('M'), (byte)('N'), (byte)('O' ), (byte)('P'), (byte)('Q') }; Assert.IsTrue(Arrays.Equals(expectedBytes, bytes)); ID3v2UrlFrameData frameDataCopy = new ID3v2UrlFrameData(false, bytes); Assert.AreEqual(frameData, frameDataCopy); }
public virtual void TestShouldConvertFrameDataToBytesAndBackToEquivalentObject() { ID3v2UrlFrameData frameData = new ID3v2UrlFrameData(false, new EncodedText(unchecked((byte)0), TEST_DESCRIPTION), TEST_URL); byte[] bytes = frameData.ToBytes(); byte[] expectedBytes = new byte[] { 0, (byte)('D'), (byte)('E'), (byte)('S'), (byte )('C'), (byte)('R'), (byte)('I'), (byte)('P'), (byte)('T'), (byte)('I'), (byte)( 'O'), (byte)('N'), 0, (byte)('h'), (byte)('t'), (byte)('t'), (byte)('p'), (byte) (':'), (byte)('/'), (byte)('/'), (byte)('A'), (byte)('B'), (byte)('C'), (byte)('D' ), (byte)('E'), (byte)('F'), (byte)('G'), (byte)('H'), (byte)('I'), (byte)('J'), (byte)('K'), (byte)('L'), (byte)('M'), (byte)('N'), (byte)('O'), (byte)('P'), (byte )('Q') }; Assert.IsTrue(Arrays.Equals(expectedBytes, bytes)); ID3v2UrlFrameData frameDataCopy = new ID3v2UrlFrameData(false, bytes); Assert.AreEqual(frameData, frameDataCopy); }
public virtual void TestShouldConvertFrameDataWithUnicodeDescriptionToBytesAndBackToEquivalentObject() { ID3v2UrlFrameData frameData = new ID3v2UrlFrameData(false, new EncodedText(EncodedText.TEXT_ENCODING_UTF_16, TEST_DESCRIPTION_UNICODE), TEST_URL); byte[] bytes = frameData.ToBytes(); byte[] expectedBytes = new byte[] { 1, unchecked((byte)unchecked((int)(0xff))), unchecked( (byte)unchecked((int)(0xfe))), unchecked((byte)unchecked((int)(0xb3))), unchecked( (int)(0x03)), unchecked((byte)unchecked((int)(0xb5))), unchecked((int)(0x03)), unchecked( (byte)unchecked((int)(0xb9))), unchecked((int)(0x03)), unchecked((byte)unchecked( (int)(0xac))), unchecked((int)(0x03)), 0, 0, (byte)('h'), (byte)('t'), (byte)('t' ), (byte)('p'), (byte)(':'), (byte)('/'), (byte)('/'), (byte)('A'), (byte)('B'), (byte)('C'), (byte)('D'), (byte)('E'), (byte)('F'), (byte)('G'), (byte)('H'), (byte )('I'), (byte)('J'), (byte)('K'), (byte)('L'), (byte)('M'), (byte)('N'), (byte)( 'O'), (byte)('P'), (byte)('Q') }; Assert.IsTrue(Arrays.Equals(expectedBytes, bytes)); ID3v2UrlFrameData frameDataCopy = new ID3v2UrlFrameData(false, bytes); Assert.AreEqual(frameData, frameDataCopy); }
public virtual void TestShouldConsiderTwoEquivalentObjectsEqual() { ID3v2UrlFrameData frameData1 = new ID3v2UrlFrameData(false, new EncodedText(unchecked((byte)0), TEST_DESCRIPTION), TEST_URL); ID3v2UrlFrameData frameData2 = new ID3v2UrlFrameData(false, new EncodedText(unchecked((byte)0), TEST_DESCRIPTION), TEST_URL); Assert.AreEqual(frameData1, frameData2); }
public virtual void SetUrl(string url) { if (url != null && url.Length > 0) { InvalidateDataLength(); ID3v2UrlFrameData frameData = new ID3v2UrlFrameData(UseFrameUnsynchronisation(), null, url); AddFrame(CreateFrame(ID_URL, frameData.ToBytes()), true); } }
private ID3v2UrlFrameData ExtractUrlFrameData(string id) { ID3v2FrameSet frameSet = frameSets.Get(id); if (frameSet != null) { ID3v2Frame frame = (ID3v2Frame)frameSet.GetFrames()[0]; ID3v2UrlFrameData frameData; try { frameData = new ID3v2UrlFrameData(UseFrameUnsynchronisation(), frame.GetData()); return frameData; } catch (InvalidDataException) { } } // do nothing return null; }