public void GetAlbums_GetListOfAlbumsByArtist_List() { Artist newArtist = new Artist("Radiohead"); Album newAlbum1 = new Album("OK Computer", "Radiohead"); Album newAlbum2 = new Album("Kid A", "Radiohead"); newArtist.AddAlbum(newAlbum1); newArtist.AddAlbum(newAlbum2); List <Album> _expectedList = new List <Album> { newAlbum1, newAlbum2 }; CollectionAssert.AreEqual(_expectedList, newArtist.GetAlbums()); }
private ArtistForAlbum CreateArtist(ArtistType artistType, string name) { var p = new Artist { ArtistType = artistType }; p.Names.Add(new ArtistName(p, new LocalizedString(name, ContentLanguageSelection.English))); return p.AddAlbum(new Album()); }
private IArtistWithSupport CreateArtist(ArtistType artistType, string name) { var p = new Artist { ArtistType = artistType }; p.Names.Add(new ArtistName(p, new LocalizedString(name, ContentLanguageSelection.English))); return p.AddAlbum(new Album()); }
public ActionResult CreateAlbum(int id, string title, int year, string label, string img) { Album newAlbum = new Album(title, year, label, img); Artist.AddAlbum(id, newAlbum); return(RedirectToAction("Show", id)); }
public ActionResult DetailsAfterAdd(int id) { // List<Artist> allArtists = Artist.GetAll(); Artist newArtist = Artist.FindArtistById(id); Album newAlbum = new Album(Request.Form["name"]); newArtist.AddAlbum(newAlbum); return(View("Details", newArtist)); }
public void DeleteAlbum_RemoveAnAlbumFromAnArtist_DoesNotContain() { Artist newArtist = new Artist("Paul Simon"); Album newAlbum = new Album("Graceland", "Paul Simon"); newArtist.AddAlbum(newAlbum); newArtist.DeleteAlbum(newAlbum); CollectionAssert.DoesNotContain(newArtist.GetAlbums(), newAlbum); }
static void checkLab2() { Catalog catalog = new Catalog(); Genre g1 = new Genre("Rock"); Genre g2 = new Genre("Rapcore", g1); Genre g3 = new Genre("Trash Metal", g1); Genre g4 = new Genre("Math Metal", g3); Artist a1 = new Artist("Linkin Park", Genre.FindGenre("Rapcore")); Artist a2 = new Artist("Metallica", Genre.FindGenre("Trash Metal")); Artist a3 = new Artist("AC/DC", Genre.FindGenre("Rock")); Artist a4 = new Artist("The Beatles", Genre.FindGenre("Rock")); Artist a5 = new Artist("Meshuggah", Genre.FindGenre("Math Metal")); List <Artist> a_list = new List <Artist>(); a_list.Add(a1); a_list.Add(a2); a_list.Add(a3); a_list.Add(a4); a_list.Add(a5); Album col1 = a1.AddAlbum("Best Hits", 2000); col1.AddSong("In The End"); col1.AddSong("New Divide"); col1.AddSong("Faint"); col1.AddSong("Guilty All The Same"); col1.AddSong("A Good Song"); SongList list = new SongList(); list.AddSong(a1, "Fade To Black", 2000); list.AddSong(a2, "Back In Black", 2000); list.AddSong(a3, "Crawling", 2005); Collection col2 = Collection.MakeCollection(catalog, "Best Hits", Genre.FindGenre("Rock"), 2000, list); Album col3 = a2.AddAlbum("Best Hits", 2003); col3.AddSong("Enter Sandman"); col3.AddSong("One"); col3.AddSong("A Good Song"); col3.AddSong("Master Of Puppets"); col3.AddSong("Mama Said"); MyLabs.Lab2.Single col4 = a5.AddSingle("Bleed", 2003); MyLabs.Lab2.Single col5 = a5.AddSingle("A Good Song", 2005); foreach (Artist artist in a_list) { catalog.AddArtist(artist); } catalog.Find(); }
public ActionResult Create(string title, string genre, int songs, int artist) { if (!String.IsNullOrEmpty(title) && !String.IsNullOrEmpty(genre) && songs != 0 && artist != 0) { Album newAlbum = new Album(title, genre, songs, artist); Artist foundArtist = Artist.FindById(artist); foundArtist.AddAlbum(newAlbum); } return(RedirectToAction("Index")); }
private ArtistForAlbum RestoreArtistRef(Album album, Artist artist, ArchivedArtistForAlbumContract albumRef) { if (artist != null) { return(!artist.HasAlbum(album) ? artist.AddAlbum(album, albumRef.IsSupport, albumRef.Roles) : null); } else { return(album.AddArtist(albumRef.NameHint, albumRef.IsSupport, albumRef.Roles)); } }
public void AddAlbum_AddsAlbumToArtist_True() { Album newAlbum = new Album("New Empire, Vol. 1", "Rock", 9, 0); List <Album> newList = new List <Album>() { newAlbum }; Artist newArtist = new Artist("Hollywood Undead"); newArtist.AddAlbum(newAlbum); CollectionAssert.AreEqual(newList, newArtist.Albums); }
public ActionResult Create(int artistId, string title) { Dictionary <string, object> model = new Dictionary <string, object>(); Artist artist = Artist.Find(artistId); MusicItem album = new MusicItem(title, "CD"); artist.AddAlbum(album); List <MusicItem> albums = artist.MusicItems; model.Add("albums", albums); model.Add("artist", artist); return(View("Show", model)); }
public ActionResult Create(int artistId, string albumName, int albumYear) { Dictionary <string, object> model = new Dictionary <string, object>(); Artist foundArtist = Artist.Find(artistId); Album newAlbum = new Album(albumName, albumYear); foundArtist.AddAlbum(newAlbum); List <Album> artistAlbums = foundArtist.GetAlbums(); model.Add("artist", foundArtist); model.Add("albums", artistAlbums); return(View("Show", model)); }
public ActionResult Create(int artistId, string albumTitle, string trackTotals, string runTime) { Dictionary <string, object> model = new Dictionary <string, object>(); Artist foundArtist = Artist.Find(artistId); Album newAlbum = new Album(albumTitle, trackTotals, runTime); foundArtist.AddAlbum(newAlbum); List <Album> artistAlbums = foundArtist.Albums; model.Add("albums", artistAlbums); model.Add("artist", foundArtist); return(View("Show", model)); }
public ActionResult Create(int artistId, string name, int year, string type, string genre) { Dictionary <string, object> model = new Dictionary <string, object>(); Artist selectedArtist = Artist.Find(artistId); Album newAlbum = new Album(name, year, type, genre); selectedArtist.AddAlbum(newAlbum); List <Album> artistAlbums = selectedArtist.Albums; model.Add("albums", artistAlbums); model.Add("artist", selectedArtist); return(View("Show", model)); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/add_cd"] = _ => { return(View["add_cd.cshtml"]); }; Post["/add_new_cd"] = _ => { List <Artist> allArtists = Artist.GetAllArtists(); int artistIndex = -1; if (allArtists.Count > 0) { artistIndex = Artist.Find(Request.Form["new-artist"]); } if (artistIndex == -1) { Artist newArtist = new Artist(Request.Form["new-artist"]); newArtist.AddAlbum(Request.Form["new-album"]); return(View["artist_details.cshtml", newArtist]); } else { Artist newArtist = allArtists[artistIndex]; newArtist.AddAlbum(Request.Form["new-album"]); return(View["artist_details.cshtml", newArtist]); } // return View["artist_details.cshtml", newArtist]; }; // Get["/artist_details"] = _ =>{ // Artist newArtist = new Artist(Request.Form["new-artist"]); // newArtist.AddAlbum(Request.Form["new-album"]); // return View["artist_details.cshtml", newArtist]; // }; Get["/{detailsArtist}"] = parameters => { List <Artist> allArtists = Artist.GetAllArtists(); Artist currentArtist = allArtists [Artist.Find(parameters.detailsArtist)]; return(View ["artist_details.cshtml", currentArtist]); }; Get["/view_all_artists"] = _ => { List <Artist> allArtists = Artist.GetAllArtists(); return(View["view_all_artists.cshtml", allArtists]); }; Post["/search_list"] = _ => { List <Artist> searchedList = Artist.SearchArtists(Request.Form["search-artist"]); return(View["view_all_artists.cshtml", searchedList]); }; Get["/search_form"] = _ => { return(View["search_form.cshtml"]); }; }
public void ArtistConstructor_FindAlbumInArtist_Album() { string description = "Abbey Road"; Album newAlbum = new Album(description, 1960); List <Album> albumList = new List <Album> { newAlbum }; string artistString = "The Beatles"; Artist newArtist = new Artist(artistString); newArtist.AddAlbum(newAlbum); List <Album> result = newArtist.GetAlbums(); CollectionAssert.AreEqual(albumList, result); }
public void AddAlbum_AddsAlbumtToArtistList_ArtistList() { string title1 = "Reputation"; Album newAlbum = new Album(title1); List <Album> newList = new List <Album> { newAlbum }; string name1 = "Taylor Swift"; Artist newArtist = new Artist(name1); newArtist.AddAlbum(newAlbum); List <Album> result = newArtist.Albums; CollectionAssert.AreEqual(newList, result); }
public HomeModule() { Get["/"] = _ => { return View["index.cshtml"]; };Get["/add_cd"] = _ => { return View["add_cd.cshtml"]; }; Post["/add_new_cd"] = _ =>{ List<Artist> allArtists = Artist.GetAllArtists(); int artistIndex=-1; if (allArtists.Count > 0) { artistIndex = Artist.Find(Request.Form["new-artist"]); } if (artistIndex == -1){ Artist newArtist = new Artist(Request.Form["new-artist"]); newArtist.AddAlbum(Request.Form["new-album"]); return View["artist_details.cshtml", newArtist]; } else { Artist newArtist = allArtists[artistIndex]; newArtist.AddAlbum(Request.Form["new-album"]); return View["artist_details.cshtml", newArtist]; } // return View["artist_details.cshtml", newArtist]; }; // Get["/artist_details"] = _ =>{ // Artist newArtist = new Artist(Request.Form["new-artist"]); // newArtist.AddAlbum(Request.Form["new-album"]); // return View["artist_details.cshtml", newArtist]; // }; Get["/{detailsArtist}"] = parameters => { List<Artist> allArtists = Artist.GetAllArtists(); Artist currentArtist = allArtists [Artist.Find(parameters.detailsArtist)]; return View ["artist_details.cshtml", currentArtist]; }; Get["/view_all_artists"] = _ => { List<Artist> allArtists = Artist.GetAllArtists(); return View["view_all_artists.cshtml", allArtists]; }; Post["/search_list"] = _ => { List<Artist> searchedList = Artist.SearchArtists(Request.Form["search-artist"]); return View["view_all_artists.cshtml", searchedList]; }; Get["/search_form"] = _ =>{ return View["search_form.cshtml"]; }; }
public void AddAlbum_AssociatesAlbumWithArtist_AlbumList() { //Arrange string name1 = "Walk the dog."; Album newAlbum = new Album(name1, "CD"); List <Album> newList = new List <Album> { newAlbum }; string name2 = "Work"; Artist newArtist = new Artist(name2); newArtist.AddAlbum(newAlbum); //Act List <Album> result = newArtist.Albums; //Assert CollectionAssert.AreEqual(newList, result); }
public void AddAlbum_AssociatesAlbumWithArtist_AlbumList() { //Arrange string description = "wash ass"; Album newAlbum = new Album(description); List <Album> newList = new List <Album> { newAlbum }; string name = "work"; Artist newArtist = new Artist(name); newArtist.AddAlbum(newAlbum); //Act List <Album> result = newArtist.GetAlbums(); //Assert CollectionAssert.AreEqual(newList, result); }
public void AddAlbum_AssociatesAlbumWithArtist_AlbumList() { //Arrange string title = "Walk the dog."; string albumArtist = "Walk the Line"; Album newAlbum = new Album(title, albumArtist); List <Album> newList = new List <Album> { newAlbum }; string name = "Work"; Artist newArtist = new Artist(name); newArtist.AddAlbum(newAlbum); //Act List <Album> result = newArtist.GetAlbums(); //Assert CollectionAssert.AreEqual(newList, result); }
public HomeModule() { Get["/"] = _ => { List <Album> allAlbums = Album.GetAll(); return(View["index.cshtml", allAlbums]); }; Get["/album/new"] = _ => View["album_new_form.cshtml"]; Get["/artist_search_form"] = _ => View["artist_search_form.cshtml"]; Post["/"] = _ => { string title = Request.Form["new-album-title"]; string artist = Request.Form["new-album-artist"]; Album newAlbum = new Album(title, artist); List <int> matchedArtists = Artist.ArtistExists(artist); if (matchedArtists.Count > 0) { Artist foundArtist = Artist.Find(matchedArtists[0]); foundArtist.AddAlbum(newAlbum); } else { Artist newArtist = new Artist(artist); newArtist.AddAlbum(newAlbum); } List <Album> allAlbums = Album.GetAll(); return(View["index.cshtml", allAlbums]); }; Get["/artist"] = _ => { string searchedArtist = Request.Query["artist-name"]; List <Artist> artistContained = Artist.SearchArtists(searchedArtist); return(View["search_results.cshtml", artistContained]); }; Get["/album/{id}"] = parameters => { Album album = Album.Find(parameters.id); album.GetTitle(); return(View["album.cshtml", album]); }; }
public virtual ArtistForAlbum AddArtist(Artist artist, bool isSupport, ArtistRoles roles) { ParamIs.NotNull(() => artist); return(artist.AddAlbum(this, isSupport, roles)); }
public virtual ArtistForAlbum AddArtist(Artist artist) { ParamIs.NotNull(() => artist); return(artist.AddAlbum(this)); }