Exemplo n.º 1
0
        public void T8_GetBands_RetrievesAllVenueBands()
        {
            Venue testVenue = new Venue("Paramount Theatre");

            testVenue.Save();

            Band testBand1 = new Band("Brand New");

            testBand1.Save();
            Band testBand2 = new Band("A Little Old");

            testBand2.Save();

            DateTime performanceDate1 = new DateTime(2016, 08, 04);
            DateTime performanceDate2 = new DateTime(2016, 09, 20);

            Performance newPerformance1 = new Performance(testVenue.GetId(), testBand1.GetId(), performanceDate1);

            newPerformance1.Save();
            Performance newPerformance2 = new Performance(testVenue.GetId(), testBand2.GetId(), performanceDate2);

            newPerformance2.Save();

            List <Band> testBands = new List <Band> {
                testBand1, testBand2
            };
            List <Band> result = testVenue.GetBands();

            Assert.Equal(testBands, result);
        }
Exemplo n.º 2
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());
        }
Exemplo n.º 3
0
        public void T6_GetVenues_RetrievesAllBandVenues()
        {
            Band testBand = new Band("Brand New");

            testBand.Save();

            Venue testVenue1 = new Venue("Paramount Theatre");

            testVenue1.Save();
            Venue testVenue2 = new Venue("Epicodus Classroom");

            testVenue2.Save();

            DateTime performanceDate1 = new DateTime(2016, 08, 04);
            DateTime performanceDate2 = new DateTime(2016, 09, 20);

            Performance newPerformance1 = new Performance(testVenue1.GetId(), testBand.GetId(), performanceDate1);

            newPerformance1.Save();
            Performance newPerformance2 = new Performance(testVenue2.GetId(), testBand.GetId(), performanceDate2);

            newPerformance2.Save();

            List <Venue> testVenues = new List <Venue> {
                testVenue1, testVenue2
            };
            List <Venue> result = testBand.GetVenues();

            Assert.Equal(testVenues, result);
        }
Exemplo n.º 4
0
        public void AddVenue(Venue newVenue)
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO bands_venues (venue_id, band_id) VALUES (@VenueId, @BandId);", conn);

            SqlParameter venueIdParameter = new SqlParameter();

            venueIdParameter.ParameterName = "@VenueId";
            venueIdParameter.Value         = newVenue.GetId();
            cmd.Parameters.Add(venueIdParameter);

            SqlParameter bandIdParameter = new SqlParameter();

            bandIdParameter.ParameterName = "@BandId";
            bandIdParameter.Value         = this.GetId();
            cmd.Parameters.Add(bandIdParameter);

            cmd.ExecuteNonQuery();

            if (conn != null)
            {
                conn.Close();
            }
        }
Exemplo n.º 5
0
        public void AddVenue(Venue newVenue)
        {
            MySqlConnection conn = DB.Connection();

            conn.Open();
            var cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"INSERT INTO bands_venues (venue_id, band_id ) VALUES (@VenueId, @BandId);";

            MySqlParameter venue_id = new MySqlParameter();

            venue_id.ParameterName = "@VenueId";
            venue_id.Value         = newVenue.GetId();
            cmd.Parameters.Add(venue_id);

            MySqlParameter band_id = new MySqlParameter();

            band_id.ParameterName = "@BandId";
            band_id.Value         = _id;
            cmd.Parameters.Add(band_id);

            cmd.ExecuteNonQuery();
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
        public void Test_Find_FindsVenueInDatabase()
        {
            Venue testVenue = new Venue("Shatter Dome");
              testVenue.Save();

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

              Assert.Equal(testVenue, foundVenue);
        }
Exemplo n.º 7
0
        public void Delete_DeleteBandFromVenue()
        {
            Venue newVenue = new Venue("Tractor Tavern");

            newVenue.Save();

            Venue.Delete(newVenue.GetId());

            Assert.Equal(0, Venue.GetAll().Count);
        }
Exemplo n.º 8
0
        public void T5_Find_FindsVenueInDB()
        {
            Venue testVenue = new Venue("Paramount Theatre");

            testVenue.Save();

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

            Assert.Equal(testVenue, foundVenue);
        }
Exemplo n.º 9
0
        public void Delete_RemoveVenueFromDatabase_Deleted()
        {
            Venue newVenue = new Venue("High Dive");

            newVenue.Save();

            Venue.Delete(newVenue.GetId());

            Assert.Equal(0, Venue.GetAll().Count);
        }
Exemplo n.º 10
0
        public void Test5_FindsVenueInDatabase()
        {
            Venue testVenue = new Venue("Skydome");

            testVenue.Save();

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

            Assert.Equal(testVenue, foundVenue);
        }
Exemplo n.º 11
0
        public void Find_FindsVenueInDatabase_true()
        {
            Venue testVenue = new Venue("Crystal Ballroom");

            testVenue.Save();

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

            Assert.Equal(testVenue, foundVenue);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
        public void Venue_Update_UpdatesInDb()
        {
            Venue testVenue = new Venue("Name");

            testVenue.Save();
            testVenue.Update("new Name");

            Venue newVenue = new Venue("new Name", testVenue.GetId());

            Assert.Equal(testVenue, newVenue);
        }
Exemplo n.º 14
0
        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);
        }
Exemplo n.º 15
0
        public void Test_Update_UpdateVenueInDatabase()
        {
            Venue testVenue = new Venue("THE SPACE");

            testVenue.Save();

            testVenue.Update("THE COLOSSEUM AT CAESAR’S PALACE");
            Venue actual   = testVenue;
            Venue expected = new Venue("THE COLOSSEUM AT CAESAR’S PALACE", testVenue.GetId());

            Assert.Equal(expected, actual);
        }
Exemplo n.º 16
0
        public void T4_Save_AssignsIdToVenue()
        {
            Venue testVenue = new Venue("Paramount Theatre");

            testVenue.Save();

            Venue savedVenue = Venue.GetAll()[0];
            int   result     = savedVenue.GetId();
            int   testId     = testVenue.GetId();

            Assert.Equal(testId, result);
        }
Exemplo n.º 17
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);
        }
Exemplo n.º 18
0
        public void Save_SaveToDatabase_SaveWithId()
        {
            Venue testVenue = new Venue("THE SPACE");

            testVenue.Save();
            Venue savedVenue = Venue.GetAll()[0];

            int result   = savedVenue.GetId();
            int expected = testVenue.GetId();

            Assert.Equal(expected, result);
        }
Exemplo n.º 19
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);
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
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);
        }
Exemplo n.º 22
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);
        }
Exemplo n.º 23
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);
        }
Exemplo n.º 24
0
        public void AddVenue(Venue newVenue)
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO venues_bands (band_id, venue_id) VALUES (@BandId, @VenueId);", conn);

            cmd.Parameters.Add(new SqlParameter("@BandId", this.GetId()));
            cmd.Parameters.Add(new SqlParameter("@VenueId", newVenue.GetId()));

            DB.CloseNonQuery(cmd, conn);
        }
Exemplo n.º 25
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);
        }
Exemplo n.º 26
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);
        }
Exemplo n.º 27
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);
        }
Exemplo n.º 28
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());
        }
Exemplo n.º 29
0
        public void Test4_Save_AssignsId()
        {
            Venue testVenue = new Venue("Skydome");

            testVenue.Save();

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

            int result = savedVenue.GetId();
            int testId = testVenue.GetId();

            Assert.Equal(testId, result);
        }
Exemplo n.º 30
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);
        }
Exemplo n.º 31
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());
        }
        public void Test_Delete_DeletesVenueFromDatabase()
        {
            Venue testVenue1 = new Venue("Shatter Dome");
              testVenue1.Save();
              Venue testVenue2 = new Venue("Belly of the Beast");
              testVenue2.Save();

              Venue.Delete(testVenue1.GetId());

              List<Venue> testList = new List<Venue>{testVenue2};
              List<Venue> resultList = Venue.GetAll();

              Assert.Equal(testList, resultList);
        }
Exemplo n.º 33
0
        public void T4_Save_AssignsIdToCagetoryObject()
        {
            //Arrange

              Venue testVenue = new Venue("A");
              testVenue.Save();

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

              int result = savedVenue.GetId();
              int testId = testVenue.GetId();

              //Assert
              Assert.Equal(testId, result);
        }
        public void Test_Update_UpdatesVenueWithNewValues()
        {
            Venue testVenue = new Venue("Shatter Dome");
              testVenue.Save();

              testVenue.SetName("Belly of the Beast");
              testVenue.Update();

              Venue resultVenue = Venue.Find(testVenue.GetId());
              Venue test = new Venue("Belly of the Beast", testVenue.GetId());

              Assert.Equal(test, resultVenue);
        }
Exemplo n.º 35
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);
 }
Exemplo n.º 36
0
 public void Test_Save_AssignsIdToObject()
 {
     //Arrange
       Venue testVenue = new Venue("The Neptune");
       //Act
       testVenue.Save();
       Venue savedVenue = Venue.GetAll()[0];
       int result = savedVenue.GetId();
       int testId = testVenue.GetId();
       //Assert
       Assert.Equal(testId, result);
 }
        public void AddVenue(Venue newVenue)
        {
            SqlConnection conn = DB.Connection();
              conn.Open();

              SqlCommand cmd = new SqlCommand("INSERT INTO venues_bands (venue_id, band_id) VALUES (@VenueId, @BandId);", conn);

              SqlParameter venueIdParameter = new SqlParameter();
              venueIdParameter.ParameterName = "@VenueId";
              venueIdParameter.Value = newVenue.GetId();

              SqlParameter bandIdParameter = new SqlParameter();
              bandIdParameter.ParameterName = "@BandId";
              bandIdParameter.Value = this.GetId();

              cmd.Parameters.Add(venueIdParameter);
              cmd.Parameters.Add(bandIdParameter);

              cmd.ExecuteNonQuery();

              if (conn != null)
              {
            conn.Close();
              }
        }