Пример #1
0
        public void UpdateName_OneVenue_NewName()
        {
            Venue newVenue = new Venue("Radi City");

            newVenue.Save();

            newVenue.UpdateName("Radio City Music Hall");

            string newName = newVenue.GetName();

            Assert.Equal("Radio City Music Hall", newName);
        }
Пример #2
0
        public void T6_Update_UpdatesVenueInDB()
        {
            Venue testVenue = new Venue("Epicodus Classroom");

            testVenue.Save();
            string newName = "Paramount Theatre";

            testVenue.Update(newName);
            string result = testVenue.GetName();

            Assert.Equal(newName, result);
        }
Пример #3
0
        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());
        }
Пример #4
0
 public override bool Equals(System.Object otherVenue)
 {
     if (!(otherVenue is Venue))
     {
         return(false);
     }
     else
     {
         Venue newVenue     = (Venue)otherVenue;
         bool  nameEquality = (this.GetName() == newVenue.GetName());
         return(nameEquality);
     }
 }
Пример #5
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());
        }
Пример #6
0
        public void Update_EditsVenueName()
        {
            Venue venue = new Venue("The Showbox");

            venue.Save();

            string newVenueName = "The Crocodile";

            venue.Update(newVenueName);

            string actualResult = venue.GetName();

            Assert.Equal(newVenueName, actualResult);
        }
Пример #7
0
        public void Update_OneVenue_NewName()
        {
            Venue testVenue1 = new Venue("ven1");
            testVenue1.Save();
            Venue testVenue2 = new Venue("ven2");
            testVenue2.Save();

            testVenue1.Update("ven11");

            string newName = testVenue1.GetName();
            string result = "ven11";

            Assert.Equal(newName, result);
        }
Пример #8
0
        public void Test_Update_UpdatesVenueInDatabase()
        {
            //Arrange
            Venue newVenue = new Venue("Roseland Theater");

            newVenue.Save();
            string newName = "Beacon Theatre";

            //Act
            newVenue.Update(newName);
            string resultNewName = newVenue.GetName();

            //Assert
            Assert.Equal(newName, resultNewName);
        }
Пример #9
0
        public void Test_Update_UpdatesVenueInDatabase()
        {
            //Arrange
            string name      = "The Vogue";
            Venue  testVenue = new Venue(name);

            testVenue.Save();
            string newName = "The NiteLite";

            //Act
            testVenue.Update(newName);
            string result = testVenue.GetName();

            //Assert
            Assert.Equal(newName, result);
        }
Пример #10
0
 public override bool Equals(System.Object otherVenue)
 {
     if (!(otherVenue is Venue))
     {
         return(false);
     }
     else
     {
         Venue newVenue         = (Venue)otherVenue;
         bool  idEquality       = (this.GetId() == newVenue.GetId());
         bool  nameEquality     = (this.GetName() == newVenue.GetName());
         bool  locationEquality = (this.GetLocation() == newVenue.GetLocation());
         bool  capacityEquality = (this.GetCapacity() == newVenue.GetCapacity());
         return(idEquality && nameEquality && capacityEquality && locationEquality);
     }
 }
Пример #11
0
        public void Test_Update_UpdatesVenueInDataBase()
        {
            //Arrange
            Venue testVenue = new Venue("The Hollywood Bowl, Los Angeles, CA");

            testVenue.Save();

            //Act
            string newVenue = "The Troubadour, West London, EU";

            testVenue.Update(newVenue);
            string result = testVenue.GetName();

            //Assert
            Assert.Equal(newVenue, result);
        }
Пример #12
0
        public void UpdateVenue_UpdateVenuesInDatabase_true()
        {
            //Arrange
            string name      = "Gorge";
            Venue  testVenue = new Venue(name, 2);

            testVenue.Save();
            string newName = "Gorge Amphitheater";

            //Act
            testVenue.UpdateVenue(newName);

            string result = testVenue.GetName();

            //Assert
            Assert.Equal(newName, result);
        }
Пример #13
0
        public void Test_SaveAssignsIdToObject()
        {
            //Arrange
            Venue testVenue = new Venue("Name");

            testVenue.Save();

            //Act
            Venue savedVenue = Venue.GetAll()[0];

            Console.WriteLine(testVenue.GetName());
            int result = savedVenue.GetId();
            int testId = testVenue.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Пример #14
0
        public void Test_Update_UpdatesVenueInDatabase()
        {
            //Arrange
            Venue testVenue = new Venue("Rose Quarter", "Portland", 20000);

            testVenue.Save();
            string newName     = "moda";
            string newLocation = "mars";
            int    newCapacity = 10000;

            //Act
            testVenue.Update("moda", "mars", 10000);
            string result1 = testVenue.GetName();
            string result2 = testVenue.GetLocation();
            int    result3 = testVenue.GetCapacity();

            //Assert
            Assert.Equal(newName, result1);
            Assert.Equal(newLocation, result2);
            Assert.Equal(newCapacity, result3);
        }
        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]);
            };
        }
Пример #16
0
 public void Test_Update_UpdatesVenueInDatabase()
 {
     //Arrange
       string name = "The Vogue";
       Venue testVenue = new Venue(name);
       testVenue.Save();
       string newName = "The NiteLite";
       //Act
       testVenue.Update(newName);
       string result = testVenue.GetName();
       //Assert
       Assert.Equal(newName, result);
 }
Пример #17
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };
            Get["/venues"] = _ => {
                List <Venue> AllVenues = Venue.GetAll();
                return(View["venues.cshtml", AllVenues]);
            };
            Get["/bands"] = _ => {
                List <Band> AllBands = Band.GetAll();
                return(View["bands.cshtml", AllBands]);
            };
            Get["/venues/new"] = _ => {
                return(View["venues_form.cshtml"]);
            };
            Post["/venues/new"] = _ => {
                Venue newVenue = new Venue(Request.Form["venue-description"]);
                newVenue.Save();
                newVenue.Update(newVenue.ForceCapital(newVenue.GetName()));
                return(View["success.cshtml"]);
            };
            Get["/bands/new"] = _ => {
                return(View["bands_form.cshtml"]);
            };
            Post["/bands/new"] = _ => {
                Band newBand = new Band(Request.Form["band-name"]);
                newBand.Save();
                newBand.Update(newBand.ForceCapital(newBand.GetName()));
                return(View["success.cshtml"]);
            };
            Get["venues/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Venue       SelectedVenue         = Venue.Find(parameters.id);
                List <Band> VenueBands            = SelectedVenue.GetBands();
                List <Band> AllBands = Band.GetAll();
                model.Add("venue", SelectedVenue);
                model.Add("venueBands", VenueBands);
                model.Add("allBands", AllBands);
                return(View["venue.cshtml", model]);
            };

            Get["bands/{id}"] = parameters => {
                Dictionary <string, object> model = new Dictionary <string, object>();
                Band         SelectedBand         = Band.Find(parameters.id);
                List <Venue> BandVenues           = SelectedBand.GetVenues();
                List <Venue> AllVenues            = Venue.GetAll();
                model.Add("band", SelectedBand);
                model.Add("bandVenues", BandVenues);
                model.Add("allVenues", AllVenues);
                return(View["band.cshtml", model]);
            };
            Post["venue/add_band"] = _ => {
                Band  band  = Band.Find(Request.Form["band-id"]);
                Venue venue = Venue.Find(Request.Form["venue-id"]);
                venue.AddBand(band);
                return(View["success.cshtml"]);
            };
            Post["band/add_venue"] = _ => {
                Band  band  = Band.Find(Request.Form["band-id"]);
                Venue venue = Venue.Find(Request.Form["venue-id"]);
                band.AddVenue(venue);
                return(View["success.cshtml"]);
            };
            Get["venues/update/{id}"] = parameters =>
            {
                Venue foundVenue = Venue.Find(parameters.id);
                return(View["venue_update.cshtml", foundVenue]);
            };
            Patch["venues/update/{id}"] = parameters =>
            {
                Venue foundVenue = Venue.Find(parameters.id);
                foundVenue.Update(Request.Form["new-description"]);
                return(View["success.cshtml"]);
            };
            Get["bands/update/{id}"] = parameters =>
            {
                Band foundBand = Band.Find(parameters.id);
                return(View["band_update.cshtml", foundBand]);
            };
            Patch["bands/update/{id}"] = parameters =>
            {
                Band foundBand = Band.Find(parameters.id);
                foundBand.Update(Request.Form["new-description"]);
                return(View["success.cshtml"]);
            };
            Delete["band/delete/{id}"] = parameters =>
            {
                Band foundBand = Band.Find(parameters.id);
                foundBand.Delete();
                return(View["success.cshtml"]);
            };
            Delete["venue/delete/{id}"] = parameters =>
            {
                Venue foundVenue = Venue.Find(parameters.id);
                foundVenue.Delete();
                return(View["success.cshtml"]);
            };
            Delete["venues/delete_all"] = _ => {
                Venue.DeleteAll();
                return(View["success.cshtml"]);
            };
        }