Пример #1
0
        public void AddVenue(Venue newVenue)
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO venues_bands (venues_id, bands_id) VALUES (@VenueId, @BandsId);", conn);

            SqlParameter bandIdParameter = new SqlParameter();

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

            SqlParameter venueIdParameter = new SqlParameter();

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

            cmd.ExecuteNonQuery();

            if (conn != null)
            {
                conn.Close();
            }
        }
Пример #2
0
        public void TEST_FindReturnsVenue()
        {
            Venue tempVenue = new Venue("Grand Palace");

            tempVenue.Save();

            Assert.Equal(tempVenue, Venue.Find(tempVenue.GetId()));
        }
Пример #3
0
        public void Test_CheckUpdateVenueInfo_True()
        {
            Venue testVenue = new Venue("Venue", "Portland");

            testVenue.Save();
            int id = testVenue.GetId();

            Venue.Update("Venue", "Seattle", id);
            Venue updated = Venue.Find(id);

            Assert.Equal(updated.GetCity(), "Seattle");
        }
Пример #4
0
        public void Test_CheckDeleteVenue_False()
        {
            Venue testVenue = new Venue("Venue", "Portland");

            testVenue.Save();
            List <Venue> result = Venue.GetAll();

            Venue.RemoveAVenue(testVenue.GetId());
            List <Venue> deleted = Venue.GetAll();
            bool         isEqual = (result == deleted);

            Assert.Equal(false, isEqual);
        }
Пример #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);
   }
 }