public void YearSetTest() { Mp3Tags tags = new Mp3Tags(); tags.SetTag("year", "2015"); Assert.AreEqual(2015u, tags.Year); tags.SetTag("year", "two thousand fifteen"); }
public void SetTest() { Mp3Tags tags=new Mp3Tags(); ArgumentException expectedException=null; try { tags.SetTag(null, "sd"); } catch (ArgumentException e) { expectedException = e; } Assert.IsNotNull(expectedException); tags.SetTag("artist","test"); Assert.AreEqual("test",tags.Artist); tags.SetTag("album", "test"); Assert.AreEqual("test", tags.Album); tags.SetTag("coMment", "test"); Assert.AreEqual("test", tags.Comment); tags.SetTag("genre", "test"); Assert.AreEqual("test", tags.Genre); tags.SetTag("title", "test"); Assert.AreEqual("test", tags.Title); tags.SetTag("not existing tag","value"); }
internal Mp3Tags GetTagsFromName(Mask mask) { var tags = new Mp3Tags(); var tagsFromName = mask.GetTagValuesFromString(CurrentFile.Name); foreach (var tag in tagsFromName.First()) { tags.SetTag(tag.Key, tag.Value); } return(tags); }
Mp3Tags GetTagsFromFileName(IMp3File file) { if (file == null) throw new ArgumentException("File is not loaded"); Menu.PrintHelp(); var fileName = file.Name; var mask = new Mask(Menu.GetUserInput("mask:")); var tagValues = Select(mask.GetTagValuesFromString(fileName)); var result = new Mp3Tags(); foreach (var tagValue in tagValues) { result.SetTag(tagValue.Key, tagValue.Value); } return result; }
internal Mp3Tags GetTagsFromName(Mask mask) { var tags = new Mp3Tags(); var tagsFromName = mask.GetTagValuesFromString(CurrentFile.Name); foreach (var tag in tagsFromName.First()) { tags.SetTag(tag.Key, tag.Value); } return tags; }