public void Test_Find_FindsBandInDatabase()
        {
            Band testBand = new Band("Frets on Fire", 0);
              testBand.Save();

              Band foundBand = Band.Find(testBand.GetId());

              Assert.Equal(testBand, foundBand);
        }
Example #2
0
        public void Find_ReturnsFoundBand_name()
        {
            Band newBand = new Band("Radiohead");

            newBand.Save();

            Band foundBand = Band.Find(newBand.GetId());

            Assert.Equal(newBand, foundBand);
        }
Example #3
0
        public void Find_VenueId_ReturnVenueFromDatabase()
        {
            Band testBand = new Band("THE SPACE");

            testBand.Save();

            Band foundBand = Band.Find(testBand.GetId());

            Assert.Equal(testBand, foundBand);
        }
Example #4
0
        public void Test5_FindBandInDatabase()
        {
            Band testBand = new Band("Sting");

            testBand.Save();

            Band foundBand = Band.Find(testBand.GetId());

            Assert.Equal(testBand, foundBand);
        }
Example #5
0
        public void Delete_RemoveBandFromDatabase_Deleted()
        {
            Band newBand = new Band("Adele");

            newBand.Save();

            Band.Delete(newBand.GetId());

            Assert.Equal(0, Band.GetAll().Count);
        }
        public void T5_Find_FindsBandInDB()
        {
            Band testBand = new Band("Brand New");

            testBand.Save();

            Band foundBand = Band.Find(testBand.GetId());

            Assert.Equal(testBand, foundBand);
        }
Example #7
0
 public void Test_Find_FindsBandInDatabase()
 {
     //Arrange
       Band testBand = new Band("The NoiseMakers");
       testBand.Save();
       //Act
       Band foundBand = Band.Find(testBand.GetId());
       //Assert
       Assert.Equal(testBand, foundBand);
 }
Example #8
0
        public void Band_Update_UpdatesInDb()
        {
            Band testBand = new Band("Name");

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

            Band newBand = new Band("new Name", testBand.GetId());

            Assert.Equal(testBand, newBand);
        }
Example #9
0
        public void Find_ReturnsBandBasedOnId_Band()
        {
            Band newBand = new Band("Journey");

            newBand.Save();

            Band expectedResult = newBand;
            Band actualResult   = Band.Find(newBand.GetId());

            Assert.Equal(expectedResult, actualResult);
        }
Example #10
0
        public void Find_FindsBandInDB_True()
        {
            //Arrange
            Band newBand = new Band("Misery Jackyls", "3308698686");

            newBand.Save();
            Band foundBand = Band.Find(newBand.GetId());

            //Assert
            Assert.Equal(foundBand, newBand);
        }
Example #11
0
        public void Test_Find_FindsBandInDatabase()
        {
            //Arrange
            Band testBand = new Band("Reo", "rock");

            testBand.Save();
            //Act
            Band foundBand = Band.Find(testBand.GetId());

            //Assert
            Assert.Equal(testBand, foundBand);
        }
Example #12
0
        public void T4_Save_AssignsIdToBand()
        {
            Band testBand = new Band("Brand New");

            testBand.Save();

            Band savedBand = Band.GetAll()[0];
            int  result    = savedBand.GetId();
            int  testId    = testBand.GetId();

            Assert.Equal(testId, result);
        }
        public void Test_Find_FindsBandsInDatabase()
        {
            //Arrange
            Band testBand = new Band("The Rolling Stones");

            testBand.Save();
            //Act
            Band foundBand = Band.Find(testBand.GetId());

            //Assert
            Assert.Equal(testBand, foundBand);
        }
Example #14
0
        public void Save_SaveToDatabase_SaveWithId()
        {
            Band testBand = new Band("THE SPACE");

            testBand.Save();
            Band savedBand = Band.GetAll()[0];

            int result   = savedBand.GetId();
            int expected = testBand.GetId();

            Assert.Equal(expected, result);
        }
        public void Find_FindsBandById_true()
        {
            //Arrange
            Band newBand = new Band("Wilson Phillips");

            newBand.Save();
            //Act
            Band foundBand = Band.Find(newBand.GetId());

            //Assert
            Assert.Equal(newBand, foundBand);
        }
Example #16
0
        public void Find_BandById_FoundBand()
        {
            Band newBand1 = new Band("CCR");

            newBand1.Save();
            Band newBand2 = new Band("Lily Allen");

            newBand2.Save();

            Band foundBand = Band.Find(newBand2.GetId());

            Assert.Equal(foundBand, newBand2);
        }
        public void Edit_ChangesName_true()
        {
            //Arrange
            Band newBand = new Band("Three Dog Night");

            newBand.Save();
            //Act
            newBand.Edit("Dog's Eye View");
            Band foundBand = Band.Find(newBand.GetId());

            //Assert
            Assert.Equal("Dog's Eye View", foundBand.GetName());
        }
Example #18
0
        public void Test_Find_FindBandInDatabase()
        {
            //Arrange
            Band testBand = new Band("Pentatonix", "Pop", "Problem");

            testBand.Save();

            //Act
            Band foundBand = Band.Find(testBand.GetId());

            //Assert
            Assert.Equal(testBand, foundBand);
        }
Example #19
0
        public void Test_Find_FindsBandInDatabase()
        {
            //Arrange
            Band firstBand = new Band("Cameo");

            firstBand.Save();

            //Act
            Band result = Band.Find(firstBand.GetId());

            //Assert
            Assert.Equal(firstBand, result);
        }
Example #20
0
        public void Find_FindsBandInDatabase_true()
        {
            //Arrange
            Band testBand = new Band("Black Keys");

            testBand.Save();

            //Act
            Band foundBand = Band.Find(testBand.GetId());

            //Assert
            Assert.Equal(testBand, foundBand);
        }
Example #21
0
        public void Find_FindsBandInDatabase_Band()
        {
            //Arrange
            Band testBand = new Band("John Mayer Trio");

            testBand.Save();

            //Act
            Band result = Band.Find(testBand.GetId());

            //Assert
            Assert.Equal(testBand, result);
        }
Example #22
0
        public void Test4_SavesIdForBandObject()
        {
            Band testBand = new Band("Nirvana");

            testBand.Save();

            Band savedBand = Band.GetAll()[0];

            int result = savedBand.GetId();
            int testId = testBand.GetId();

            Assert.Equal(testId, result);
        }
Example #23
0
 public override bool Equals(System.Object otherBand)
 {
     if (!(otherBand is Band))
     {
         return(false);
     }
     else
     {
         Band newBand      = (Band)otherBand;
         bool idEquality   = this.GetId() == newBand.GetId();
         bool nameEquality = this.GetName() == newBand.GetName();
         return(idEquality && nameEquality);
     }
 }
Example #24
0
        public void Test_Save_AssignsIdToBandObject()
        {
            //Arrange
            Band testBand = new Band("The Rough Nighters");

            testBand.Save();
            //Act
            Band savedBand = Band.GetAll()[0];
            int  result    = savedBand.GetId();
            int  testId    = testBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Example #25
0
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            Band testBand = new Band("Brittany Spears");

            //Act
            testBand.Save();
            Band savedBand = Band.GetAll()[0];

            int result = savedBand.GetId();
            int testId = testBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
        public void T6_GetBandName_GetsPerformanceBandName()
        {
            Band testBand = new Band("Brand New");

            testBand.Save();
            DateTime performanceDate = new DateTime(2016, 08, 04);

            Performance testPerformance = new Performance(1, testBand.GetId(), performanceDate);

            testPerformance.Save();

            string result = testPerformance.GetBandName();

            Assert.Equal("Brand New", result);
        }
Example #27
0
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            Band testBand = new Band("Pentatonix", "Pop", "Problem");

            //Act
            testBand.Save();
            Band savedBand = Band.GetAll()[0];

            int result = savedBand.GetId();
            int testId = testBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Example #28
0
        public void Save_AssignsIdToBandObject_true()
        {
            //Arrange
            Band testBand = new Band("Florence and the Machine");

            testBand.Save();

            //Act
            Band savedBand = Band.GetAll()[0];

            int result = savedBand.GetId();
            int testId = testBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Example #29
0
        public void Test_Save_AssignsIdToObject()
        {
            //Arrange
            Band testBand = new Band("Angry Fish");

            //Act
            testBand.Save();
            Band savedBand = Band.GetBands()[0];


            int result = savedBand.GetId();
            int testId = testBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Example #30
0
        public void Test_SaveAssignsIdToObject()
        {
            //Arrange
            Band firstBand = new Band("Cameo");

            firstBand.Save();

            //Act
            Band savedBand = Band.GetAll()[0];

            int result = savedBand.GetId();
            int testId = firstBand.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Example #31
0
        public void Test_Find_FindsBandInDatabase()
        {
            //Arrange
            Band testBand1 = new Band("band1");

            testBand1.Save();

            Band testBand2 = new Band("band2");

            testBand2.Save();

            //Act
            Band result = Band.Find(testBand2.GetId());

            //Assert
            Assert.Equal(testBand2, result);
        }
Example #32
0
        public void AddBand(Band newBand)
        {
            SqlConnection conn = DB.Connection();

            conn.Open();

            SqlCommand cmd = new SqlCommand("INSERT INTO bands_venues (band_id, venue_id) OUTPUT INSERTED.id VALUES (@BandId, @VenueID);", conn);

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

            if (conn != null)
            {
                conn.Close();
            }
        }
Example #33
0
        // methods to interact with the Band class
        // a method to add a new link between a band and venue instance
        public void AddBand(Band newBand)
        {
            SqlConnection conn = DB.Connection();
              conn.Open();

              SqlCommand cmd = new SqlCommand("INSERT INTO events (venue_id, band_id) VALUES (@VenueId, @BandId);", conn);
              SqlParameter venueIdParameter = new SqlParameter();
              venueIdParameter.ParameterName = "@VenueId";
              venueIdParameter.Value = this.GetId();
              cmd.Parameters.Add(venueIdParameter);
              SqlParameter bandIdParameter = new SqlParameter();
              bandIdParameter.ParameterName = "@BandId";
              bandIdParameter.Value = newBand.GetId();
              cmd.Parameters.Add(bandIdParameter);

              cmd.ExecuteNonQuery();
              if (conn != null)
              {
            conn.Close();
              }
        }
Example #34
0
 public void Test_Save_AssignsIdToBandObject()
 {
     //Arrange
       Band testBand = new Band("The Rough Nighters");
       testBand.Save();
       //Act
       Band savedBand = Band.GetAll()[0];
       int result = savedBand.GetId();
       int testId = testBand.GetId();
       //Assert
       Assert.Equal(testId, result);
 }
Example #35
0
        public void Test_Find_FindsBandInDatabase()
        {
            DateTime testTime = new DateTime(2016, 1, 1);

              Band testBand = new Band("A",testTime);
              testBand.Save();

              Band foundBand = Band.Find(testBand.GetId());

              Assert.Equal(testBand, foundBand);
        }
Example #36
0
        public void Test_Save_AssignsIdToObject()
        {
            DateTime testTime = new DateTime(2016, 1, 1);

              Band testBand=new Band("A",testTime);

              testBand.Save();
              Band savedBand = Band.GetAll()[0];
              int result=savedBand.GetId();
              int testId=testBand.GetId();

              Assert.Equal(testId,result);
        }