public void Band_Find_FindsBandInDB() { Band controlBand = new Band("Maroon5"); controlBand.Save(); Band testBand = Band.Find(controlBand.Id); Assert.Equal(controlBand, testBand); }
public void Test5_FindBandInDatabase() { Band testBand = new Band("Sting"); testBand.Save(); Band foundBand = Band.Find(testBand.GetId()); Assert.Equal(testBand, foundBand); }
public void Test_Find_FindsBandInDatablase() { //Arrange firstBand.Save(); //Act Band foundBand = Band.Find(firstBand.GetBandId()); //Asswert Assert.Equal(firstBand, foundBand); }
public void T5_Find_FindsBandInDB() { Band testBand = new Band("Brand New"); testBand.Save(); Band foundBand = Band.Find(testBand.GetId()); Assert.Equal(testBand, foundBand); }
public void Test_Find_ReturnsSpecificBandFromDatabase() { Band testBand = new Band("Some Band Name", "Some Band Description"); testBand.Save(); Band result = Band.Find(testBand.Id); Assert.Equal(result, testBand); }
public void Find_ReturnsFoundBand_name() { Band newBand = new Band("Radiohead"); newBand.Save(); Band foundBand = Band.Find(newBand.GetId()); Assert.Equal(newBand, foundBand); }
public void Find_VenueId_ReturnVenueFromDatabase() { Band testBand = new Band("THE SPACE"); testBand.Save(); Band foundBand = Band.Find(testBand.GetId()); Assert.Equal(testBand, foundBand); }
public void Find_FindsBandInDB_True() { //Arrange Band newBand = new Band("Misery Jackyls", "3308698686"); newBand.Save(); Band foundBand = Band.Find(newBand.GetId()); //Assert Assert.Equal(foundBand, newBand); }
public void Find_ReturnsBandBasedOnId_Band() { Band newBand = new Band("Journey"); newBand.Save(); Band expectedResult = newBand; Band actualResult = Band.Find(newBand.GetId()); Assert.Equal(expectedResult, actualResult); }
public void Test_Find_FindsBandsInDatabase() { //Arrange Band testBand = new Band("The Rolling Stones"); testBand.Save(); //Act Band foundBand = Band.Find(testBand.GetId()); //Assert Assert.Equal(testBand, foundBand); }
public void Test_Find_FindsBandInDatabase() { //Arrange Band testBand = new Band("Reo", "rock"); testBand.Save(); //Act Band foundBand = Band.Find(testBand.GetId()); //Assert Assert.Equal(testBand, foundBand); }
[Fact] //CREATE + READ public void Save_SavesToDataBase_EquivalentObject() { //Arrange Band testBand = new Band("The Chameleons", 4); //Act testBand.Save(); Band retrievedBand = Band.Find(testBand.Id); //Assert Assert.Equal(testBand, retrievedBand); }
public void Find_FindsBandById_true() { //Arrange Band newBand = new Band("Wilson Phillips"); newBand.Save(); //Act Band foundBand = Band.Find(newBand.GetId()); //Assert Assert.Equal(newBand, foundBand); }
public void Find_FindsBandInDatabase_true() { //Arrange Band testBand = new Band("Rooky Band", "Rock"); testBand.Save(); //Act Band result = Band.Find(testBand.Id); //Assert Assert.Equal(testBand, result); }
public void Find_BandById_FoundBand() { Band newBand1 = new Band("CCR"); newBand1.Save(); Band newBand2 = new Band("Lily Allen"); newBand2.Save(); Band foundBand = Band.Find(newBand2.GetId()); Assert.Equal(foundBand, newBand2); }
public void Edit_ChangesName_true() { //Arrange Band newBand = new Band("Three Dog Night"); newBand.Save(); //Act newBand.Edit("Dog's Eye View"); Band foundBand = Band.Find(newBand.GetId()); //Assert Assert.Equal("Dog's Eye View", foundBand.GetName()); }
public void Test_Find_FindBandInDatabase() { //Arrange Band testBand = new Band("Pentatonix", "Pop", "Problem"); testBand.Save(); //Act Band foundBand = Band.Find(testBand.GetId()); //Assert Assert.Equal(testBand, foundBand); }
public void Find_FindsBandInDatabase_Band() { //Arrange Band testBand = new Band("John Mayer Trio"); testBand.Save(); //Act Band result = Band.Find(testBand.GetId()); //Assert Assert.Equal(testBand, result); }
public void Find_FindsBandInDatabase_true() { //Arrange Band testBand = new Band("Black Keys"); testBand.Save(); //Act Band foundBand = Band.Find(testBand.GetId()); //Assert Assert.Equal(testBand, foundBand); }
public void Test_Find_FindsBandInDatabase() { //Arrange Band testBand1 = new Band("band1"); testBand1.Save(); Band testBand2 = new Band("band2"); testBand2.Save(); //Act Band result = Band.Find(testBand2.GetId()); //Assert Assert.Equal(testBand2, result); }
public HomeModule() { Get["/"] = _ => { List <Band> allBands = Band.GetAll(); return(View["index.cshtml", allBands]); }; Get["/venues"] = _ => { List <Venue> allVenues = Venue.GetAll(); return(View["venues.cshtml", allVenues]); }; Get["/venues/new"] = _ => { return(View["venue_form.cshtml"]); }; Post["/venues/new"] = _ => { string venueName = Request.Form["venue-name"]; string venueLocation = Request.Form["venue-location"]; Venue newVenue = new Venue(venueName, venueLocation); newVenue.Save(); return(View["venue_added.cshtml", newVenue]); }; Get["/bands/new"] = _ => { return(View["band_form.cshtml"]); }; Post["/bands/new"] = _ => { string bandName = Request.Form["band-name"]; string bandDescription = Request.Form["band-description"]; Band newBand = new Band(bandName, bandDescription); newBand.Save(); return(View["band_added.cshtml", newBand]); }; Get["/venue/{id}"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); return(View["venue.cshtml", selectedVenue]); }; Get["/band/{id}"] = parameters => { Band selectedBand = Band.Find(parameters.id); return(View["band.cshtml", selectedBand]); }; Get["/venue/{id}/new_band"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); return(View["venue_add_band.cshtml", selectedVenue]); }; Post["/venue/{id}/new_band"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); int bandId = int.Parse(Request.Form["band-id"]); Band selectedBand = Band.Find(bandId); selectedVenue.AddBand(selectedBand); return(View["venue.cshtml", selectedVenue]); }; Get["/band/{id}/new_venue"] = parameters => { Band selectedBand = Band.Find(parameters.id); return(View["band_add_venue.cshtml", selectedBand]); }; Post["/band/{id}/new_venue"] = parameters => { Band selectedBand = Band.Find(parameters.id); int venueId = int.Parse(Request.Form["venue-id"]); Venue selectedVenue = Venue.Find(venueId); selectedBand.AddVenue(selectedVenue); return(View["band.cshtml", selectedBand]); }; Get["/venue/edit/{id}"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); return(View["venue_edit.cshtml", selectedVenue]); }; Patch["/venue/edit/{id}"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); string venueName = Request.Form["venue-name"]; string venueLocation = Request.Form["venue-location"]; selectedVenue.Update(venueName, venueLocation); Venue updatedVenue = Venue.Find(parameters.id); return(View["venue_edited.cshtml", updatedVenue]); }; Get["/band/edit/{id}"] = parameters => { Band selectedBand = Band.Find(parameters.id); return(View["band_edit.cshtml", selectedBand]); }; Patch["/band/edit/{id}"] = parameters => { Band selectedBand = Band.Find(parameters.id); string bandName = Request.Form["band-name"]; string bandDescription = Request.Form["band-description"]; selectedBand.Update(bandName, bandDescription); Band updatedBand = Band.Find(parameters.id); return(View["band_edited.cshtml", updatedBand]); }; Get["/venue/delete/{id}"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); return(View["venue_delete.cshtml", selectedVenue]); }; Delete["/venue/delete/{id}"] = parameters => { Venue selectedVenue = Venue.Find(parameters.id); selectedVenue.Delete(); return(View["entry_deleted.cshtml"]); }; Get["/band/delete/{id}"] = parameters => { Band selectedBand = Band.Find(parameters.id); return(View["band_delete.cshtml", selectedBand]); }; Delete["/band/delete/{id}"] = parameters => { Band selectedBand = Band.Find(parameters.id); selectedBand.Delete(); return(View["entry_deleted.cshtml"]); }; Delete["/band/remove_venue/{id}"] = parameters => { int bandId = int.Parse(Request.Form["band-id"]); Band selectedBand = Band.Find(bandId); Venue selectedVenue = Venue.Find(parameters.id); selectedBand.RemoveVenue(selectedVenue); return(View["band.cshtml", selectedBand]); }; Delete["/venue/remove_band/{id}"] = parameters => { int venueId = int.Parse(Request.Form["venue-id"]); Venue selectedVenue = Venue.Find(venueId); Band selectedBand = Band.Find(parameters.id); selectedVenue.RemoveBand(selectedBand); return(View["venue.cshtml", selectedVenue]); }; }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/add/band"] = _ => { List <Band> allBands = Band.GetAll(); return(View["band_form.cshtml", allBands]); }; Post["/add/band"] = _ => { Band newBand = new Band(Request.Form["band-name"], Request.Form["contact"]); newBand.Save(); return(View["bands.cshtml", Band.GetAll()]); }; Get["/band/{id}"] = parameters => { Dictionary <string, object> bandDict = new Dictionary <string, object>(); var currentBand = Band.Find(parameters.id); bandDict.Add("band", currentBand); List <Venue> allVenues = Venue.GetAll(); bandDict.Add("venues", allVenues); List <Venue> bandVenues = currentBand.GetVenues(); bandDict.Add("venuesPlayed", bandVenues); return(View["band.cshtml", bandDict]); }; Get["/add/band/{id}/venue"] = parameters => { Band currentBand = Band.Find(parameters.id); List <Venue> allVenues = Venue.GetAll(); Dictionary <string, object> bandVenues = new Dictionary <string, object>(); bandVenues.Add("band", currentBand); bandVenues.Add("venues", allVenues); return(View["add_venue_to_band.cshtml", bandVenues]); }; Post["/add/band/{id}/venue"] = parameters => { Dictionary <string, object> bandDict = new Dictionary <string, object>(); Band currentBand = Band.Find(parameters.id); int venueMenueItem = int.Parse(Request.Form["venue_id"]); Venue currentVenue = Venue.Find(venueMenueItem); currentBand.AddVenue(currentVenue); bandDict.Add("band", currentBand); List <Venue> allVenues = Venue.GetAll(); bandDict.Add("venues", allVenues); List <Venue> bandVenues = currentBand.GetVenues(); bandDict.Add("venuesPlayed", bandVenues); return(View["band.cshtml", bandDict]); }; Delete["/band/{id}/delete"] = parameters => { Band currentBand = Band.Find(parameters.id); currentBand.Delete(); return(View["band_form.cshtml", Band.GetAll()]); }; Get["/add/venue"] = _ => { List <Venue> allVenues = Venue.GetAll(); return(View["venue_form.cshtml", allVenues]); }; Post["/add/venue"] = _ => { Venue newVenue = new Venue(Request.Form["venue-name"], Request.Form["contact"]); newVenue.Save(); return(View["venues.cshtml", Venue.GetAll()]); }; Get["/venue/{id}"] = parameters => { Dictionary <string, object> VenueDict = new Dictionary <string, object>(); var currentVenue = Venue.Find(parameters.id); VenueDict.Add("Venue", currentVenue); List <Band> allBands = Band.GetAll(); VenueDict.Add("bands", allBands); List <Band> bandVenues = currentVenue.GetBands(); VenueDict.Add("bandsPlayed", bandVenues); return(View["venue.cshtml", VenueDict]); }; Get["/add/venue/{id}/band"] = parameters => { Venue currentVenue = Venue.Find(parameters.id); List <Band> allBands = Band.GetAll(); Dictionary <string, object> bandVenues = new Dictionary <string, object>(); bandVenues.Add("band", allBands); bandVenues.Add("Venue", currentVenue); return(View["add_band_to_venue.cshtml", bandVenues]); }; Post["/add/venue/{id}/band"] = parameters => { Dictionary <string, object> venueDict = new Dictionary <string, object>(); Venue currentVenue = Venue.Find(parameters.id); int bandMenueItem = int.Parse(Request.Form["band_id"]); Band currentBand = Band.Find(bandMenueItem); currentVenue.AddBand(currentBand); venueDict.Add("Venue", currentVenue); List <Band> allBands = Band.GetAll(); venueDict.Add("bands", allBands); List <Band> bandVenues = currentVenue.GetBands(); venueDict.Add("bandsPlayed", bandVenues); return(View["venue.cshtml", venueDict]); }; Get["/edit/venue/{id}"] = parameters => { Venue currentVenue = Venue.Find(parameters.id); return(View["edit_venue_form.cshtml", currentVenue]); }; Patch["edit/venue/{id}"] = parameters => { Dictionary <string, object> VenueDict = new Dictionary <string, object>(); Venue currentVenue = Venue.Find(parameters.id); currentVenue.Edit(Request.Form["venue-name"], Request.Form["contact"]); VenueDict.Add("Venue", currentVenue); List <Band> allBands = Band.GetAll(); VenueDict.Add("bands", allBands); List <Band> bandVenues = currentVenue.GetBands(); VenueDict.Add("bandsPlayed", bandVenues); return(View["venue.cshtml", VenueDict]); }; Delete["/venue/{id}/delete"] = parameters => { Venue currentVenue = Venue.Find(parameters.id); currentVenue.Delete(); return(View["venue_form.cshtml", Venue.GetAll()]); }; }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Get["/bands"] = _ => { List <Band> allBands = Band.GetAll(); return(View["bands.cshtml", allBands]); }; Get["/venues"] = _ => { List <Venue> allVenues = Venue.GetAll(); return(View["venues.cshtml", allVenues]); }; Get["/bands/new"] = _ => { return(View["newband.cshtml"]); }; Post["/bands"] = _ => { Band newBand = new Band(Request.Form["band-name"]); newBand.Save(); List <Band> allBands = Band.GetAll(); return(View["bands.cshtml", allBands]); }; Get["/bands/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>() { }; Band newBand = Band.Find(parameters.id); List <Venue> allVenues = Venue.GetAll(); List <Venue> bandVenues = newBand.GetVenues(); model.Add("band", newBand); model.Add("venues", allVenues); model.Add("bandVenues", bandVenues); return(View["band.cshtml", model]); }; Post["/bands/{id}"] = parameters => { Venue newVenue = Venue.Find(Request.Form["venue"]); Band newBand = Band.Find(parameters.id); newBand.AddVenue(newVenue); Dictionary <string, object> model = new Dictionary <string, object>() { }; List <Venue> allVenues = Venue.GetAll(); List <Venue> bandVenues = newBand.GetVenues(); model.Add("band", newBand); model.Add("venues", allVenues); model.Add("bandVenues", bandVenues); return(View["band.cshtml", model]); }; Get["/venues/new"] = _ => { return(View["newvenue.cshtml"]); }; Post["/venues"] = _ => { Venue newVenue = new Venue(Request.Form["venue-name"]); newVenue.Save(); List <Venue> allVenues = Venue.GetAll(); return(View["venues.cshtml", allVenues]); }; Get["/venues/{id}"] = parameters => { Dictionary <string, object> model = new Dictionary <string, object>() { }; Venue newVenue = Venue.Find(parameters.id); List <Band> allBands = Band.GetAll(); List <Band> venueBands = newVenue.GetBands(); model.Add("venue", newVenue); model.Add("bands", allBands); model.Add("venueBands", venueBands); return(View["venue.cshtml", model]); }; Post["/venues/{id}"] = parameters => { Venue newVenue = Venue.Find(parameters.id); Band newBand = Band.Find(Request.Form["band"]); newVenue.AddBand(newBand); Dictionary <string, object> model = new Dictionary <string, object>() { }; List <Band> allBands = Band.GetAll(); List <Band> venueBands = newVenue.GetBands(); model.Add("venue", newVenue); model.Add("bands", allBands); model.Add("venueBands", venueBands); return(View["venue.cshtml", model]); }; Patch["/venues/{id}"] = parameters => { Venue newVenue = Venue.Find(parameters.id); newVenue.Update(Request.Form["venue"]); Dictionary <string, object> model = new Dictionary <string, object>() { }; List <Band> allBands = Band.GetAll(); List <Band> venueBands = newVenue.GetBands(); model.Add("venue", newVenue); model.Add("bands", allBands); model.Add("venueBands", venueBands); return(View["venue.cshtml", model]); }; Get["/venues/{id}/edit"] = parameters => { Venue newVenue = Venue.Find(parameters.id); return(View["editvenue.cshtml", newVenue]); }; Get["/venues/{id}/delete"] = parameters => { Venue newVenue = Venue.Find(parameters.id); return(View["deletevenue.cshtml", newVenue]); }; Delete["/venues/{id}/delete"] = parameters => { Venue newVenue = Venue.Find(parameters.id); string name = newVenue.GetName(); newVenue.Delete(); return(View["success.cshtml", name]); }; }