Beispiel #1
0
        public void Venue_Find_FindsVenueInDB()
        {
            Venue controlVenue = new Venue("Modacenter", 6000);

            controlVenue.Save();
            Venue testVenue = Venue.Find(controlVenue.Id);

            Assert.Equal(controlVenue, testVenue);
        }
Beispiel #2
0
        public void Test_Find_ReturnsSpecificVenueFromDatabase()
        {
            Venue testVenue = new Venue("Staples Center", "Los Angeles, CA");

            testVenue.Save();

            Venue result = Venue.Find(testVenue.Id);

            Assert.Equal(result, testVenue);
        }
        public void Find_FindsVenueInDatabase_true()
        {
            Venue testVenue = new Venue("Crystal Ballroom");

            testVenue.Save();

            Venue foundVenue = Venue.Find(testVenue.GetId());

            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #4
0
        public void Test5_FindsVenueInDatabase()
        {
            Venue testVenue = new Venue("Skydome");

            testVenue.Save();

            Venue foundVenue = Venue.Find(testVenue.GetId());

            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #5
0
        public void T5_Find_FindsVenueInDB()
        {
            Venue testVenue = new Venue("Paramount Theatre");

            testVenue.Save();

            Venue foundVenue = Venue.Find(testVenue.GetId());

            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #6
0
        public void Test_Find_FindsVenueInDatablase()
        {
            //Arrange
            firstVenue.Save();
            //Act
            Venue foundVenue = Venue.Find(firstVenue.GetVenueId());

            //Asswert
            Assert.Equal(firstVenue, foundVenue);
        }
        public void Find_FindsVenueInDB_True()
        {
            //Arrange
            Venue newVenue = new Venue("AKron Agora", "3308698686");

            newVenue.Save();
            Venue foundVenue = Venue.Find(newVenue.GetId());

            //Assert
            Assert.Equal(foundVenue, newVenue);
        }
Beispiel #8
0
        public void Find_ReturnsVenueBasedOnId_Venue()
        {
            Venue newVenue = new Venue("The Showbox");

            newVenue.Save();

            Venue expectedResult = newVenue;
            Venue actualResult   = Venue.Find(newVenue.GetId());

            Assert.Equal(expectedResult, actualResult);
        }
Beispiel #9
0
        public void Test_Find_FindsVenueInDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("El Corazon");

            testVenue.Save();
            //Act
            Venue foundVenue = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #10
0
        public void Update_UpdatesDatabase_True()
        {
            Venue newVenue = new Venue("Doug Fur");

            newVenue.Save();
            newVenue.Update("Doug Fir");

            Venue testVenue = new Venue("Doug Fir");
            Venue result    = Venue.Find(newVenue.GetId());

            Assert.Equal(testVenue, result);
        }
Beispiel #11
0
        [Fact] //CREATE + READ
        public void Save_SavesToDataBase_EquivalentObject()
        {
            //Arrange
            Venue testVenue = new Venue("Doug Fir", "Medium", 300);

            //Act
            testVenue.Save();
            Venue retrievedVenue = Venue.Find(testVenue.Id);

            //Assert
            Assert.Equal(testVenue, retrievedVenue);
        }
Beispiel #12
0
        public void Test_Find_FindsVenueInDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("Rose Quarter", "Portland", 20000);

            testVenue.Save();
            //Act
            Venue foundVenue = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
        public void Update_UpdatesDatabase_True()
        {
            Venue newVenue = new Venue("Rose Garden");

            newVenue.Save();
            newVenue.Update("Moda Center");

            Venue testVenue = new Venue("Moda Center");
            Venue result    = Venue.Find(newVenue.GetId());

            Assert.Equal(testVenue, result);
        }
Beispiel #14
0
        public void Find_FindsVenueById_true()
        {
            //Arrange
            Venue newVenue = new Venue("CBGB");

            newVenue.Save();
            //Act
            Venue foundVenue = Venue.Find(newVenue.GetId());

            //Assert
            Assert.Equal(newVenue, foundVenue);
        }
Beispiel #15
0
        public void Test_FindFindsVenueInDatabase()
        {
            //Arrange
            Venue firstVenue = new Venue("Salmon");

            firstVenue.Save();

            //Act
            Venue result = Venue.Find(firstVenue.GetId());

            //Assert
            Assert.Equal(firstVenue, result);
        }
Beispiel #16
0
        public void Edit_ChangesName_true()
        {
            //Arrange
            Venue newVenue = new Venue("CBGBBQ");

            newVenue.Save();
            //Act
            newVenue.Edit("CBGB");
            Venue foundVenue = Venue.Find(newVenue.GetId());

            //Assert
            Assert.Equal("CBGB", foundVenue.GetName());
        }
Beispiel #17
0
        public void Test_FindFindsVenueInDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("Name");

            testVenue.Save();

            //Act
            Venue result = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, result);
        }
Beispiel #18
0
        public void Test_Find_FindsVenueInDataBAse()
        {
            //Arrange
            Venue testVenue = new Venue("The Hollywood Bowl, Los Angeles, CA");

            testVenue.Save();

            //Act
            Venue foundVenue = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
        public void Update_UpdatesVenueInDb_True()
        {
            //Arrange
            Venue newVenue = new Venue("AKron Agora", "3308698686");

            newVenue.Save();
            //Act
            newVenue.Edit("Peabodys", "3307625903");
            Venue editedVenue = Venue.Find(newVenue.GetId());

            //Assert
            Assert.Equal("Peabodys", editedVenue.GetName());
        }
Beispiel #20
0
        public void Test_UpdateName_VenueNameUpdate()
        {
            //Arrange
            Venue testVenue = new Venue("Fly Fish");

            testVenue.Save();

            //Act
            Venue.UpdateName(testVenue.GetId(), "Angry Fish");

            //Assert
            Assert.Equal("Angry Fish", Venue.Find(testVenue.GetId()).GetName());
        }
Beispiel #21
0
        public void Find_VenueById_FoundVenue()
        {
            Venue newVenue1 = new Venue("Hollywood Bowl");

            newVenue1.Save();
            Venue newVenue2 = new Venue("Irvine Amphitheater");

            newVenue2.Save();

            Venue foundVenue = Venue.Find(newVenue2.GetId());

            Assert.Equal(foundVenue, newVenue2);
        }
Beispiel #22
0
        public void Find_FindsVenueInDatabase_true()
        {
            //Arrange
            Venue testVenue = new Venue("westin Ball Room", "Portland, OR");

            testVenue.Save();

            //Act
            Venue result = Venue.Find(testVenue.Id);

            //Assert
            Assert.Equal(testVenue, result);
        }
Beispiel #23
0
        public void Find_FindsVenueInDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("The Showbox");

            testVenue.Save();

            //Act
            Venue foundVenue = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #24
0
        public void Find_VenueId_ReturnVenueFromDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("THE SPACE");

            testVenue.Save();

            //Act
            Venue foundVenue = Venue.Find(testVenue.GetId());

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
Beispiel #25
0
        public void Test_Find_FindsVenueInDatabase()
        {
            //Arrange
            Venue testVenue1 = new Venue("ven1");
            testVenue1.Save();

            Venue testVenue2 = new Venue("ven2");
            testVenue2.Save();

            //Act
            Venue result = Venue.Find(testVenue2.GetId());

            //Assert
            Assert.Equal(testVenue2, result);
        }
Beispiel #26
0
        public HomeModule()
        {
            //Shows --- Index Page
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };


            //BANDS --- Shows --- Entire Band List Page
            Get["/bands"] = _ => {
                List <Band> BandList = Band.GetAll();
                return(View["bands_all.cshtml", BandList]);
            };
            // BAND --- Adds --- Band to Band Added Page (popUp)
            Post["/bands"] = _ => {
                Band newBand = new Band(Request.Form["band-add"]);
                newBand.Save();
                List <Band> BandList = Band.GetAll();
                return(View["bands_all.cshtml", BandList]);
            };


            //VENUES --- Shows --- Entire Venue List Page
            Get["/venues"] = _ => {
                List <Venue> VenueList = Venue.GetAll();
                return(View["venues_all.cshtml", VenueList]);
            };
            // VENUE --- Adds --- Venue to Venue Added Page (popUp)
            Post["/venues"] = _ => {
                Venue newVenue = new Venue(Request.Form["venue-add"]);
                newVenue.Save();
                List <Venue> VenueList = Venue.GetAll();
                return(View["venues_all.cshtml", VenueList]);
            };
            // VENUE MANAGEMENT HERE -------------------------
            //VENUES --- Shows --- Venue Add Band / Edit/Delete Page
            Get["/venue/{id}/manage"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Venue       SelectedVenue         = Venue.Find(parameters.id);
                List <Band> VenueWBands           = SelectedVenue.GetBands();
                List <Band> BandList = Band.GetAll();
                model.Add("venue", SelectedVenue);
                model.Add("venuesWBands", VenueWBands);
                model.Add("bandList", BandList);
                return(View["venue_manage.cshtml", model]);
            };

            // Venue - Add band to Venue
            Post["/venues/band-added"] = _ => {
                Band  band  = Band.Find(Request.Form["band-id"]);
                Venue venue = Venue.Find(Request.Form["venue-id"]);
                venue.AddBand(band);
                return(View["success.cshtml"]);
            };

            // Venue - edit venue
            Patch["/venue/{id}/edited"] = parameters => {
                Venue selectedVenue = Venue.Find(parameters.id);
                selectedVenue.Update(Request.Form["venue-name"]);
                return(View["success.cshtml", selectedVenue]);
            };

            // Venue - delete Venue
            Delete["/venue/{id}/deleted"] = parameters => {
                Venue selectedVenue = Venue.Find(parameters.id);
                selectedVenue.Delete();
                List <Venue> AllVenues = Venue.GetAll();
                return(View["success.cshtml", AllVenues]);
            };

            /////  BAND MANAGEMENT HERE -------------
            Get["/band/{id}/manage"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Band         SelectedBand         = Band.Find(parameters.id);
                List <Venue> BandWVenues          = SelectedBand.GetVenues();
                List <Venue> VenueList            = Venue.GetAll();
                model.Add("band", SelectedBand);
                model.Add("bandsWVenues", BandWVenues);
                model.Add("venueList", VenueList);
                return(View["band_manage.cshtml", model]);
            };

            // Band - Add venue to Band
            Post["/bands/venue-added"] = _ => {
                Venue venue = Venue.Find(Request.Form["venue-id"]);
                Band  band  = Band.Find(Request.Form["band-id"]);
                band.AddVenue(venue);
                return(View["success.cshtml"]);
            };

            // Band - edit band
            Patch["/band/{id}/edited"] = parameters => {
                Band selectedBand = Band.Find(parameters.id);
                selectedBand.Update(Request.Form["band-name"]);
                return(View["success.cshtml", selectedBand]);
            };

            // Band - delete Band
            Delete["/band/{id}/deleted"] = parameters => {
                Band selectedBand = Band.Find(parameters.id);
                selectedBand.Delete();
                List <Band> AllBands = Band.GetAll();
                return(View["success.cshtml", AllBands]);
            };
        }
        public HomeModule()
        {
            Get["/"] = _ => {
                List <Venue> allVenues = Venue.GetAll();
                return(View["index.cshtml", allVenues]);
            };

            Get["/band/new"] = _ => {
                return(View["bands_venues.cshtml"]);
            };

            Post["/"] = _ => {
                Venue newVenue = new Venue(Request.Form["venue-name"]);
                newVenue.Save();
                return(View["index.cshtml", Venue.GetAll()]);
            };

            Post["/venue/{id}/band/new"] = parameters => {
                Band newBand = new Band(Request.Form["band-name"]);
                newBand.Save();
                Venue SelectedVenue = Venue.Find(parameters.id);
                SelectedVenue.AddBand(newBand);
                Dictionary <string, object> model = new Dictionary <string, object>();
                List <Band> BandList = SelectedVenue.GetBands();
                model.Add("venue", SelectedVenue);
                model.Add("bands", BandList);

                return(View["bands_venues.cshtml", model]);
            };

            Get["/venue/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Venue       SelectedVenue         = Venue.Find(parameters.id);
                List <Band> BandList = SelectedVenue.GetBands();
                model.Add("venue", SelectedVenue);
                model.Add("bands", BandList);
                return(View["bands_venues.cshtml", model]);
            };


            Post["/band/{id}/venue"] = parameters => {
                Venue newVenue = new Venue(Request.Form["venue-name"]);
                newVenue.Save();
                Band SelectedBand = Band.Find(parameters.id);
                SelectedBand.AddVenue(newVenue);
                Dictionary <string, object> model = new Dictionary <string, object>();
                List <Venue> VenueList            = SelectedBand.GetVenues();
                model.Add("band", SelectedBand);
                model.Add("venue", VenueList);

                return(View["venues_of_bands.cshtml", VenueList]);
            };

            Get["/band/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Band         SelectedBand         = Band.Find(parameters.id);
                List <Venue> VenueList            = SelectedBand.GetVenues();
                model.Add("band", SelectedBand);
                model.Add("venue", VenueList);
                return(View["venues_of_bands.cshtml", model]);
            };

            Delete["/venue/delete/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Venue SelectedVenue = Venue.Find(parameters.id);
                SelectedVenue.Delete();
                model.Add("venue", SelectedVenue);
                return(View["success.cshtml", model]);
            };

            Get["/band/delete/{id}"] = parameters => {
                Band SelectedBand = Band.Find(parameters.id);
                return(View["bands_venues.cshtml", SelectedBand]);
            };

            Patch["/venue/{id}/edit"] = parameters => {
                Venue SelectedVenue = Venue.Find(parameters.id);
                SelectedVenue.UpdateVenue(Request.Form["venue-name"]);
                return(View["success.cshtml"]);
            };


            Delete["/band/delete/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Band SelectedBand = Band.Find(parameters.id);
                SelectedBand.Delete();
                model.Add("band", SelectedBand);
                return(View["success.cshtml", model]);
            };
        }
Beispiel #28
0
        public HomeModule()
        {
            Get["/"] = _ =>
            {
                return(View["index.cshtml", ModelMaker()]);
            };

            Post["/"] = _ =>
            {
                Band newBand = new Band(Request.Form["band"]);
                newBand.Save();

                Venue newVenue = new Venue(Request.Form["venue"]);
                newVenue.Save();
                newVenue.AddBand(newBand.GetId());

                return(View["index.cshtml", ModelMaker()]);
            };

            Get["/band/{id}"] = parameters =>
            {
                Dictionary <string, object> model = new Dictionary <string, object> {
                };

                Band foundBand = Band.Find(parameters.id);
                model.Add("band", foundBand);

                List <Venue> allVenues = Venue.GetAll();
                model.Add("venues", allVenues);

                return(View["band.cshtml", model]);
            };

            Post["/band/{id}"] = parameters =>
            {
                Dictionary <string, object> model = new Dictionary <string, object> {
                };

                Band foundBand = Band.Find(parameters.id);
                model.Add("band", foundBand);

                foundBand.AddVenue(Request.Form["venue"]);

                List <Venue> allVenues = Venue.GetAll();
                model.Add("venues", allVenues);

                return(View["band.cshtml", model]);
            };

            Get["/venue/{id}"] = parameters =>
            {
                Dictionary <string, object> model = new Dictionary <string, object> {
                };

                Venue foundVenue = Venue.Find(parameters.id);
                model.Add("venue", foundVenue);

                List <Band> allBands = Band.GetAll();
                model.Add("bands", allBands);

                return(View["venue.cshtml", model]);
            };

            Post["/venue/{id}"] = parameters =>
            {
                Dictionary <string, object> model = new Dictionary <string, object> {
                };

                Venue foundVenue = Venue.Find(parameters.id);
                model.Add("venue", foundVenue);

                foundVenue.AddBand(Request.Form["band"]);

                List <Band> allBands = Band.GetAll();
                model.Add("bands", allBands);

                return(View["venue.cshtml", model]);
            };

            Delete["/venue/deleted/{id}"] = parameters =>
            {
                Venue foundVenue = Venue.Find(parameters.id);
                foundVenue.Delete();

                return(View["index.cshtml", ModelMaker()]);
            };

            Patch["/venue/edit/{id}"] = parameters =>
            {
                Dictionary <string, object> model = new Dictionary <string, object> {
                };

                Venue foundVenue = Venue.Find(parameters.id);
                foundVenue.UpdateName(Request.Form["new-venue-name"]);
                model.Add("venue", foundVenue);

                List <Band> allBands = Band.GetAll();
                model.Add("bands", allBands);

                return(View["venue.cshtml", model]);
            };
        }
Beispiel #29
0
        public HomeModule()
        {
            Get["/"] = _ =>
            {
                return(View["index.cshtml"]);
            };

            Get["/venues"] = _ =>
            {
                return(View["venues.cshtml", ModelMaker()]);
            };

            Get["/bands"] = _ =>
            {
                return(View["bands.cshtml", ModelMaker()]);
            };

            Post["/bands"] = _ =>
            {
                Band newBand = new Band(Request.Form["band"]);
                newBand.Save();
                return(View["bands.cshtml", ModelMaker()]);
            };

            Post["/venues"] = _ =>
            {
                Venue newVenue = new Venue(Request.Form["venue"]);
                newVenue.Save();
                return(View["venues.cshtml", ModelMaker()]);
            };

            Get["/bands/{id}"] = parameters =>
            {
                Dictionary <string, object> model = ModelMaker();
                model.Add("Band Object", Band.Find(parameters.id));
                model.Add("Venue List", Venue.GetAll());
                return(View["band.cshtml", model]);
            };

            Get["/venues/{id}"] = parameters =>
            {
                Dictionary <string, object> model = ModelMaker();
                model.Add("Venue Object", Venue.Find(parameters.id));
                model.Add("Band List", Band.GetAll());
                return(View["venue.cshtml", model]);
            };

            Delete["/venues/{id}"] = parameters =>
            {
                Venue.Find(parameters.id).Delete(parameters.id);
                return(View["venues.cshtml", ModelMaker()]);
            };

            Patch["/venues/{id}"] = parameters =>
            {
                Venue.Find(parameters.id).Update(Request.Form["venue"]);
                Dictionary <string, object> model = ModelMaker();
                model.Add("Venue Object", Venue.Find(parameters.id));
                model.Add("Band List", Band.GetAll());
                Console.WriteLine(Venue.Find(parameters.id));
                return(View["venue.cshtml", model]);
            };
        }
Beispiel #30
0
        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"] = _ => {
                List <Venue> AllVenues = Venue.GetAll();
                return(View["bands_form.cshtml", AllVenues]);
            };
            Post["/bands"] = _ => {
                Band newBand = new Band(Request.Form["band-name"]);
                newBand.Save();
                newBand.AddVenue(Venue.Find(Request.Form["venue-id"]));
                List <Band> AllBands = Band.GetAll();
                return(View["bands.cshtml", AllBands]);
            };
            Get["/venues/new"] = _ => {
                List <Band> AllBands = Band.GetAll();
                return(View["venues_form.cshtml", AllBands]);
            };
            Post["/venues"] = _ => {
                Venue newVenue = new Venue(Request.Form["venue-name"]);
                newVenue.Save();
                newVenue.AddBand(Band.Find(Request.Form["band-id"]));
                List <Venue> AllVenues = Venue.GetAll();
                return(View["venues.cshtml", AllVenues]);
            };

            Get["/bands/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                var SelectedBand = Band.Find(parameters.id);
                var VenueBand    = SelectedBand.GetVenues();
                model.Add("bands", SelectedBand);
                model.Add("venues", VenueBand);
                return(View["band.cshtml", model]);
            };

            Get["/venues/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                var SelectedVenue = Venue.Find(parameters.id);
                var VenueBand     = SelectedVenue.GetBands();
                model.Add("venues", SelectedVenue);
                model.Add("bands", VenueBand);
                return(View["venue.cshtml", model]);
            };

            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);
                SelectedVenue.Update(Request.Form["venue-name"]);
                List <Venue> AllVenues = Venue.GetAll();
                return(View["venues.cshtml", AllVenues]);
            };

            Post["/venues/delete"] = _ => {
                Venue.DeleteAll();
                List <Venue> AllVenues = Venue.GetAll();
                return(View["venues.cshtml", AllVenues]);
            };
            Post["/bands/delete"] = _ => {
                Band.DeleteAll();
                List <Band> AllBands = Band.GetAll();
                return(View["bands.cshtml", AllBands]);
            };
            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();
                List <Venue> AllVenues = Venue.GetAll();
                return(View["venues.cshtml", AllVenues]);
            };
            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();
                List <Band> AllBands = Band.GetAll();
                return(View["bands.cshtml", AllBands]);
            };
        }