Exemplo 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);
        }
Exemplo n.º 2
0
        public ActionResult DeleteAll()
        {
            Specialty.ClearAll();
            List <Specialty> allSpecialties = Specialty.GetAll();

            return(RedirectToAction("Index", allSpecialties));
        }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Specialty.ClearAll();
     //Appointment.ClearAll();
 }
Exemplo n.º 4
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();
            }
        }
 public void Dispose()
 {
     Stylist.ClearAll();
     Client.ClearAll();
     Specialty.ClearAll();
     Specialty.JoinTableClearAll();
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public ActionResult DeleteAll()
        {
            List <Specialty> allSpecialties = Specialty.GetAll();

            foreach (Specialty specialty in allSpecialties)
            {
                specialty.Delete();
            }
            Specialty.ClearAll();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
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);
        }
Exemplo n.º 12
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);
        }
Exemplo n.º 13
0
        public void DeleteAll_DeleteAllSpecialties()
        {
            //Arrange
            Specialty newSpecialty1 = new Specialty("Perm");

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

            newSpecialty2.Create();
            List <Specialty> expectedSpecialties = new List <Specialty> {
            };

            //Act
            Specialty.ClearAll();
            List <Specialty> Specialties = Specialty.GetAll();

            //Assert
            CollectionAssert.AreEqual(expectedSpecialties, Specialties);
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
 public void Dispose()
 {
     Stylist.ClearAll();
     Specialty.ClearAll();
 }
 public ActionResult DeleteSpecialties(int specialtyId)
 {
     Specialty.ClearAll();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 17
0
 public ActionResult DeleteAll()
 {
     Specialty.ClearAll();
     return(View());
 }
 public ActionResult DeleteAll()
 {
     Specialty.ClearAll();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 19
0
 public void Dispose()
 {
     Specialty.ClearAll();
 }
Exemplo n.º 20
0
 public ActionResult MasterSpecialtyDelete()
 {
     Specialty.ClearAll();
     return(RedirectToAction("Master"));
 }