public void Convert_ISO8859_1_Test() { var frame = new UserDefinedTextFrame(); frame.TextEncoding = Encoding.Default; frame.Descriptor.Id = "TXXX"; frame.Description = "ABCD"; frame.Value = "EFGH"; RawFrame rawFrame = frame.Convert(TagVersion.Id3V23); Assert.AreEqual(rawFrame.Id, "TXXX"); Assert.AreEqual(rawFrame.Payload.Count, 10); Assert.AreEqual(rawFrame.Payload[0], 0); // ISO coding }
public void Convert_UTF16_Test() { var frame = new UserDefinedTextFrame(); frame.TextEncoding = Encoding.Unicode; frame.Descriptor.Id = "TXXX"; frame.Description = "ABCD"; frame.Value = "EFGH"; RawFrame rawFrame = frame.Convert(TagVersion.Id3V23); Assert.AreEqual(rawFrame.Id, "TXXX"); Assert.AreEqual(rawFrame.Payload[0], 1); // ISO coding Assert.AreEqual(rawFrame.Payload[1], 0xFF); // BOM 1 Assert.AreEqual(rawFrame.Payload[2], 0xFE); // BOM 2 Assert.AreEqual(rawFrame.Payload.Count, 21); }
public void Convert_UTF16BE_Test() { var frame = new UserDefinedTextFrame(); frame.TextEncoding = Encoding.BigEndianUnicode; frame.Descriptor.Id = "TXXX"; frame.Description = "ABCD"; frame.Value = "EFGH"; RawFrame rawFrame = frame.Convert(TagVersion.Id3V23); Assert.AreEqual(rawFrame.Id, "TXXX"); var refBytes = new byte[] { 0x02, 0x00, 0x41, 0x00, 0x42, 0x00, 0x43, 0x00, 0x44, 0x00, 0x00, 0x00, 0x45, 0x00, 0x46, 0x00, 0x47, 0x00, 0x48 }; Assert.IsTrue(ComparePayload(rawFrame.Payload, refBytes)); }