private static void TestGenericCodecPicture() { byte[] data20 = { (byte)0, (byte)'P',(byte)'N', (byte)'G', (byte)3, (byte)'T',(byte)'e', (byte)'x',(byte)'t', (byte)'0', (byte)0, (byte)1, (byte)2 }; byte[] dataAbove20 = { (byte)0, (byte)'i',(byte)'m', (byte)'a', (byte)'g', (byte)'e', (byte)'/', (byte)'p',(byte)'n', (byte)'g', (byte)0, (byte)3, (byte)'T',(byte)'e', (byte)'x', (byte)'t', (byte)'0', (byte)0, (byte)1, (byte)2 }; var dataByVersion = new Dictionary <Version, byte[]>() { { Version.v2_0, data20 }, { Version.v2_3, dataAbove20 }, { Version.v2_4, dataAbove20 }, }; foreach (var item in dataByVersion) { Version v = item.Key; byte[] data = item.Value; var fc = new FrameContentPicture(TagDescriptionMap.Instance[v]); TestCodec(data, fc); UnitTest.Test((fc.Codec as FrameContentCodecGeneric).CurrentTextCodec == 0); UnitTest.Test(fc.MimeTypeText.ToLower().Contains("png")); UnitTest.Test(fc.PictureType == 3); UnitTest.Test(fc.Description == "Text0"); UnitTest.Test(fc.Content.Length == 2); UnitTest.Test(fc.Content[0] == 1); UnitTest.Test(fc.Content[1] == 2); } }
private static void TestGenericCodecPicture_2_0() { byte[] head = { (byte)0, (byte)'P',(byte)'N', (byte)'G', (byte)0, (byte)0, }; byte[] payload = TestTags.demoPicturePng; byte[] data = head.Concat(payload).ToArray(); Version v = Version.v2_0; var fc = new FrameContentPicture(TagDescriptionMap.Instance[v]); TestCodec(data, fc); UnitTest.Test((fc.Codec as FrameContentCodecGeneric).CurrentTextCodec == 0); UnitTest.Test(fc.MimeTypeText.ToLower().Contains("png")); UnitTest.Test(fc.PictureType == 0); UnitTest.Test(fc.Description == ""); UnitTest.Test(fc.Content.Length == TestTags.demoPicturePng.Length); }