//return a piece of music out the database public Music getMusic(string music) { string name = ""; int metascore = 0; int userscore = 0; string resume = ""; string genre = ""; string recordLabel = ""; DateTime date = DateTime.Today; foreach (Dictionary<string, object> D in db.getMusic(music)) { name = (string)D["naam"]; metascore = Convert.ToInt32(D["metascore"]); userscore = Convert.ToInt32(D["userscore"]); resume = (string)D["samenvatting"]; genre = (string)D["genre"]; recordLabel = (string)D["recordlabel"]; date = (DateTime)D["datum"]; } Klassen.Music newMusic = new Klassen.Music(metascore, userscore, name, genre, resume, date, recordLabel); return newMusic; }
public void TestGetMusic() { Klassen.Music music = new Klassen.Music(10, 10, "name", "genre", "resume", DateTime.Now, "record"); music = music.getMusic("Eminem"); Assert.AreEqual("Eminem", music.Name, "Check if music name is equal"); }