public static void CreateDemoTags(string path, int count, Action <TagEditor> action) { for (int i = 0; i < count; ++i) { Tag tag = TestTags.CreateDemoTag(ID3.Version.v2_3); TagEditor editor = new TagEditor(tag); editor.Title = "Song No. " + (i + 1); editor.TrackNumber = (i + 1).ToString(); editor.ReleaseYear = "1993"; action(editor); TagUtils.WriteTag(tag, new FileInfo(Path.Combine(path, "Test" + i + ".mp3"))); } }
private static void TestTagUtilsReadWriteRaw() { int counter = 0; foreach (var demoTag in TestTags.Demotags) { FileInfo fileInfo = VirtualDrive.CreateVirtualFileInfo( "TestTagUtilsReadWriteRaw\\" + counter + ".tag"); TagUtils.WriteTag(demoTag, fileInfo); byte[] tagRaw = TagUtils.ReadTagRaw(fileInfo); UnitTest.Test(ArrayUtils.IsEqual(tagRaw, demoTag)); counter++; } }
private static void TestTagUtilsBuildByCodeAndSerializeInVirtualStore() { foreach (ID3.Version version in ID3.Version.Versions) { string filename = VirtualDrive.VirtualFileName( "TestID3TagBuildByCodeAndSerializeInVirtualStore\\" + version.ToString() + ".tag"); Tag tag0 = TestTags.CreateDemoTag(version); TagUtils.WriteTag(tag0, new FileInfo(filename)); Tag tag1 = TagUtils.ReadTag(new FileInfo(filename)); TagEditor editor0 = new TagEditor(tag0); TagEditor editor1 = new TagEditor(tag1); UnitTest.Test(editor1.Equals(editor0)); } }
private static void TestTagUtilsReadWrite() { int counter = 0; foreach (var demoTag in TestTags.Demotags) { FileInfo fileInfo = VirtualDrive.CreateVirtualFileInfo( "TestTagUtilsReadWrite\\" + counter + ".tag"); TagUtils.WriteTag(demoTag, fileInfo); Tag tag0 = TagUtils.ReadTag(fileInfo); UnitTest.Test(TestTags.IsDemoTag(new TagEditor(tag0))); TagUtils.WriteTag(tag0, fileInfo); UnitTest.Test(ArrayUtils.IsEqual(TagUtils.ReadTagRaw(fileInfo), demoTag)); counter++; } }