Example #1
0
        public void AddVenues(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();
            }
        }
Example #2
0
 public void T5_Find_FindNameInDatabase()
 {
     //arrange
       Venue testVenue = new Venue("Pheonix");
       testVenue.Save();
       //act
       Venue foundVenue = Venue.Find(testVenue.GetId());
       //Assert
       Assert.Equal(testVenue, foundVenue);
 }
Example #3
0
        public void T5_Find_FindNameInDatabase()
        {
            //arrange
            Venue testVenue = new Venue("Pheonix");

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

            //Assert
            Assert.Equal(testVenue, foundVenue);
        }
Example #4
0
        public void T4_Save_AsignsIdToObject()
        {
            //arrange
              Venue newVenue = new Venue("Pheonix");
              //action
              newVenue.Save();
              Venue savedVenue = Venue.GetAll()[0];

              int result = savedVenue.GetId();
              int testId = newVenue.GetId();
              //assert
              Assert.Equal(testId, result);
        }
Example #5
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());
         return(idEquality && nameEquality);
     }
 }
Example #6
0
        public void T4_Save_AsignsIdToObject()
        {
            //arrange
            Venue newVenue = new Venue("Pheonix");

            //action
            newVenue.Save();
            Venue savedVenue = Venue.GetAll()[0];

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

            //assert
            Assert.Equal(testId, result);
        }
Example #7
0
        public void AddVenues(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();
              }
        }