public void ManageNullReading() { //Arrange //Act ReadingResult result = this.listener.Read(null); //Assert Assert.AreEqual(ReadingResult.Null, result); }
public void ManageEmptyReading() { //Arrange string reading = string.Empty; //Act ReadingResult result = this.listener.Read(reading); //Assert Assert.AreEqual(ReadingResult.Empty, result); }
public void CanReading() { //Arrange string reading = "readingtest654654687451"; //Act ReadingResult result = this.listener.Read(reading); //Assert Assert.AreEqual(ReadingResult.Ok, result); }
private Song CreateFromOldId3Standard(String filename) { ReadingResult result = ReadingResult.Failure; try { result = id3v1.Read(filename); } catch { return(null); } if (result != Tagger.ReadingResult.Success) { return(null); } this.sizeId3v1 = id3v1.Size; Genre genre; this.LookForGenre(out genre); String songTitle = string.IsNullOrEmpty(id3v1.Title) ? GuessSongName(filename) : id3v1.Title; Song song = database.Song.FindByName(songTitle); song.Filename = filename; song.Genre = genre; this.LookForArtist(song); //this.LookForGenre(song); this.LookForAlbum(song); try { database.SaveChanges(); } catch (System.Data.UpdateException ue) { //IMedia imedia = ((Song)ue.StateEntries[0].Entity); database.DeleteObject(ue.StateEntries[0].Entity); return(null); } return(song); }
private Song CreateFromWaveTagger(String filename) { ReadingResult result = ReadingResult.Failure; try { result = idwav.Read(filename); } catch { return(null); } if (result != Tagger.ReadingResult.Success) { return(null); } String title = GetTextVoice("INAM"); Song song = database.Song.FindByName(title); song.Filename = filename; song.Duration = (int)idwav.Duration; String artist = GetTextVoice("IART"); song.Artist = database.Artist.FindByName(artist); String album = GetTextVoice("IPRD"); song.Album = !string.IsNullOrEmpty(album) ? database.Album.FindByName(album) : database.Album.AddDefaultValue("Unknown"); String genre = GetTextVoice("IGNR"); try { song.Genre = database.Genre.Single(ignr => ignr.Name == genre); } catch { song.Genre = database.Genre.Single(ignr => ignr.ID == 13); } if (song.Album != null) { song.Album.Genre = song.Genre; } this.database.SaveChanges(); return(song); }