Esempio n. 1
0
        public void StylistADDGET_AddSpecialtyAndReturnThem_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Stylist newStylist1 = new Stylist("Joes", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Mandy", 30, Convert.ToDateTime("2018-02-02"));

            newStylist2.Create();
            Specialty newSpecialty = new Specialty("Mens");

            newSpecialty.Create();

            newStylist1.AddSpecialty(newSpecialty.Id);
            newStylist2.AddSpecialty(newSpecialty.Id);

            List <Stylist> testList = new List <Stylist> {
            };

            testList.Add(newStylist1);
            testList.Add(newStylist2);

            List <Stylist> resultList = newSpecialty.GetStylists();

            Assert.AreEqual(testList[0].Id, resultList[0].Id);
            Assert.AreEqual(testList[0].Name, resultList[0].Name);
            Assert.AreEqual(testList[1].Id, resultList[1].Id);
            Assert.AreEqual(testList[1].Name, resultList[1].Name);
        }
Esempio n. 2
0
        public void Dispose()
        {
            Stylist.ClearAll();
            Specialty.ClearAll();

            MySqlConnection conn = DB.Connection();

            conn.Open();

            MySqlCommand cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"ALTER TABLE stylists_clients AUTO_INCREMENT = 1;";
            cmd.ExecuteNonQuery();
            cmd.CommandText = @"ALTER TABLE stylists_specialties AUTO_INCREMENT = 1;";
            cmd.ExecuteNonQuery();
            cmd.CommandText = @"ALTER TABLE stylists AUTO_INCREMENT = 1;";
            cmd.ExecuteNonQuery();
            cmd.CommandText = @"ALTER TABLE specialties AUTO_INCREMENT = 1;";
            cmd.ExecuteNonQuery();

            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
        }
Esempio n. 3
0
        public ActionResult DeleteAll()
        {
            Stylist.ClearAll();
            List <Stylist> allStylists = Stylist.GetAll();

            return(RedirectToAction("Index", allStylists));
        }
Esempio n. 4
0
        [TestMethod] // test to see if database is cleared between tests
        public void GetAll_StylistsEmptyAtFirst_0()
        {
            Stylist.ClearAll();
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(0, result);
        }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Specialty.ClearAll();
     //Appointment.ClearAll();
 }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Specialty.ClearAll();
     Specialty.JoinTableClearAll();
 }
Esempio n. 7
0
        [TestMethod] // test to see if database is cleared between tests
        public void GetAll_SpecialtysEmptyAtFirst_0()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            int result = Specialty.GetAll().Count;

            Assert.AreEqual(0, result);
        }
Esempio n. 8
0
        [TestMethod] // test to see if find function returns proper stylist
        public void Find_FindStylist_Name()
        {
            Stylist.ClearAll();
            Stylist newStylist1 = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist test = Stylist.Find(newStylist1.Id);

            Assert.AreEqual("Jose", test.Name);
        }
Esempio n. 9
0
        public void ClearAll_ClearStylistsInDB_0()
        {
            Stylist testStylist = new Stylist("Harry Cutter");

            testStylist.Save();
            Stylist.ClearAll();
            List <Stylist> allStylists = Stylist.GetAll();

            Assert.AreEqual(0, allStylists.Count);
        }
Esempio n. 10
0
        public void ClearAll_StylistAfterClear_0()
        {
            Stylist testStylist = new Stylist("Hubert");

            testStylist.Save();
            Stylist.ClearAll();
            List <Stylist> allStylists = Stylist.GetAll();

            Assert.AreEqual(0, allStylists.Count);
        }
Esempio n. 11
0
        [TestMethod] // test to see if .Create and is creating in DB
        public void Create_StylistAddedCorrectly_True()
        {
            Stylist.ClearAll();
            Stylist newStylist = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist.Create();

            Stylist test = Stylist.GetAll()[0];

            Assert.AreEqual("Jose", test.Name);
        }
Esempio n. 12
0
        public void Find_FindAStylistInDatabase_0()
        {
            Stylist.ClearAll();
            Stylist testStylist = new Stylist("Richardson", "Bethany");

            testStylist.Save();

            Stylist foundStylist = Stylist.Find(1);

            Assert.AreEqual(testStylist, foundStylist);
        }
Esempio n. 13
0
        [TestMethod] // test to see if find function returns proper stylist
        public void Find_FindSpecialty_Name()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Specialty newSpecialty1 = new Specialty("Mens");

            newSpecialty1.Create();
            Specialty test = Specialty.Find(newSpecialty1.Id);

            Assert.AreEqual("Mens", test.Description);
        }
Esempio n. 14
0
        [TestMethod] // test to see if .Create and is creating in DB
        public void Create_SpecialtyAddedCorrectly_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Specialty newSpecialty = new Specialty("Mens");

            newSpecialty.Create();

            Specialty test = Specialty.GetAll()[0];

            Assert.AreEqual("Mens", test.Description);
        }
Esempio n. 15
0
        public void Update_ChangeSpecialtyNameCorrectly_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();

            Specialty newSpecialty1 = new Specialty("Mnnes");

            newSpecialty1.Create();
            newSpecialty1.Update("Mens");
            Specialty testSpecialty = Specialty.Find(newSpecialty1.Id);

            Assert.AreEqual("Mens", testSpecialty.Description);
        }
Esempio n. 16
0
        public void ClearAll_ReturnEmptyList()
        {
            Stylist newStylist = new Stylist("Roma", 3);

            newStylist.Save();
            Stylist newStylist1 = new Stylist("Andi", 3);

            newStylist1.Save();
            Stylist.ClearAll();
            List <Stylist> allStylists = Stylist.GetAll();
            List <Stylist> result      = new List <Stylist> {
            };

            CollectionAssert.AreEqual(allStylists, result);
        }
Esempio n. 17
0
        [TestMethod] // test to see if getall returns all lines in DB
        public void GetAll_GetAllStylists_Int()
        {
            Stylist.ClearAll();
            Stylist newStylist1 = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Maggie", 22, Convert.ToDateTime("2015-02-02"));

            newStylist2.Create();
            Stylist newStylist3 = new Stylist("Fred", 14, Convert.ToDateTime("2013-02-02"));

            newStylist3.Create();
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(result, 3);
        }
Esempio n. 18
0
        public void ClearAll_DeleteAllCusines_Int()
        {
            Stylist newStylist1 = new Stylist("Lilly");

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Doug");

            newStylist2.Create();
            Stylist.ClearAll();
            Stylist newStylist5 = new Stylist("Rose");

            newStylist5.Create();
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(result, 1);
        }
Esempio n. 19
0
        [TestMethod] // test to see if getall returns all lines in DB
        public void GetAll_GetAllSpecialtys_Int()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Specialty newSpecialty1 = new Specialty("Mens");

            newSpecialty1.Create();
            Specialty newSpecialty2 = new Specialty("Kids");

            newSpecialty2.Create();
            Specialty newSpecialty3 = new Specialty("Womens");

            newSpecialty3.Create();
            int result = Specialty.GetAll().Count;

            Assert.AreEqual(result, 3);
        }
Esempio n. 20
0
        public void ClearAll_ClearAllStylistsFromDatabase_0()
        {
            List <Stylist> testList = new List <Stylist>();
            Stylist        stylistA = new Stylist("Farron", "Alan");
            Stylist        stylistB = new Stylist("Murphy", "Brenda");
            Stylist        stylistC = new Stylist("Zamera", "Charlie");

            testList.Add(stylistA);
            testList.Add(stylistB);
            testList.Add(stylistC);
            stylistA.Save();
            stylistB.Save();
            stylistC.Save();

            Stylist.ClearAll();
            List <Stylist> resultList = Stylist.GetAll();

            Assert.AreEqual(true, resultList.Count == 0);
        }
Esempio n. 21
0
        [TestMethod] // test to see if delete removes the proper db item
        public void Delete_DeleteSpecialtys_Count()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Specialty newSpecialty1 = new Specialty("Mens");

            newSpecialty1.Create();
            Specialty newSpecialty2 = new Specialty("Kids");

            newSpecialty2.Create();
            Specialty newSpecialty3 = new Specialty("Womens");

            newSpecialty3.Create();
            Specialty.Delete(newSpecialty2.Id);
            int result = Specialty.GetAll().Count;

            Assert.AreEqual(result, 2);
        }
Esempio n. 22
0
        public void SpecialtyADDGET_AddSpecialtyAndReturnThem_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Stylist newStylist = new Stylist("Joes", 30, Convert.ToDateTime("2018-02-02"));

            newStylist.Create();
            Specialty newSpecialty1 = new Specialty("Mens");

            newSpecialty1.Create();
            Specialty newSpecialty2 = new Specialty("Womens");

            newSpecialty2.Create();

            Console.WriteLine(Specialty.GetAll().Count);

            Console.WriteLine("stylistid " + newStylist.Id);
            newStylist.AddSpecialty(newSpecialty1.Id);
            Console.WriteLine(newSpecialty1.Id + newSpecialty1.Description + newStylist.Id);
            newStylist.AddSpecialty(newSpecialty2.Id);
            Console.WriteLine(newSpecialty2.Id + newSpecialty2.Description + newStylist.Id);

            List <Specialty> testList = new List <Specialty> {
            };

            testList.Add(newSpecialty1);
            testList.Add(newSpecialty2);


            List <Specialty> resultList = newStylist.GetSpecialties();

            Assert.AreEqual(testList[0].Id, resultList[0].Id);
            Assert.AreEqual(testList[0].Description, resultList[0].Description);
            Assert.AreEqual(testList[1].Id, resultList[1].Id);
            Assert.AreEqual(testList[1].Description, resultList[1].Description);
        }
Esempio n. 23
0
 public ActionResult ClearAll()
 {
     Stylist.ClearAll();
     return(RedirectToAction("Index"));
 }
Esempio n. 24
0
 public void Dispose()
 {
     Stylist.ClearAll();
 }
Esempio n. 25
0
 public ActionResult ClearAll()
 {
     Stylist.ClearAll();
     return(Redirect("/"));
 }
Esempio n. 26
0
 public StylistTests()
 {
     DB.DatabaseTest();
     Stylist.ClearAll();
     Client.ClearAll();
 }
 public void Dispose()
 {
     Stylist.ClearAll();
     Specialty.ClearAll();
 }
Esempio n. 28
0
 public void Dispose()
 {
     Client.ClearAll();
     Stylist.ClearAll();
 }
Esempio n. 29
0
 public ActionResult DeleteAll()
 {
     Stylist.ClearAll();
     return(View());
 }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Speciality.ClearAll();
 }