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);
        }
        public ActionResult ClientCreate(string newDesc)
        {
            Specialty newSpecialty = new Specialty(newDesc);

            newSpecialty.Create();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 3
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.º 4
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.º 5
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.º 6
0
        public void Update_UpdateNewName()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Trim");

            newSpecialty.Create();
            string newName = "Color2";

            //Act
            newSpecialty.Update(newName);

            //Assert
            Assert.AreEqual(newName, newSpecialty.Name);
        }
Exemplo n.º 7
0
 public ActionResult CreateSpecialty(int stylistId)
 {
     if (Request.Method == "POST")
     {
         Specialty newSpecialty = new Specialty(Request.Form["newSpecialty"]);
         newSpecialty.Create();
         Stylist selectedStylist = Stylist.Find(stylistId);
         selectedStylist.AddSpecialty(newSpecialty);
         return(RedirectToAction("Details"));
     }
     else
     {
         return(View(stylistId));
     }
 }
Exemplo n.º 8
0
        public void Create_AddNewSpecialty()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Color2");

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

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

            //Assert
            CollectionAssert.AreEqual(expectedSpecialties, Specialties);
        }
Exemplo n.º 9
0
        public void Find_FindExactSpecialty_Specialty()
        {
            //Arrange
            Specialty newSpecialty1 = new Specialty("Cut");

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

            newSpecialty2.Create();

            //Act
            Specialty foundSpecialty = Specialty.Find(newSpecialty1.Id);

            //Assert
            Assert.AreEqual(newSpecialty1, foundSpecialty);
        }
Exemplo n.º 10
0
        public void RemoveSpecialty_CorrectlyRemoveSpecialtyFromStylist()
        {
            Specialty newSpecialty = new Specialty("Color");

            newSpecialty.Create();
            List <Specialty> test = new List <Specialty> {
            };
            Stylist newStylist    = new Stylist("Baz");

            newStylist.Create();
            newStylist.AddSpecialty(newSpecialty);
            newStylist.RemoveSpecialty(newSpecialty.Id);
            List <Specialty> allspecialtys = newStylist.GetSpecialties();

            CollectionAssert.Equals(test, allspecialtys);
        }
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 GetAll_ReturnEverySpecialties_List()
        {
            //Arrange
            Specialty newSpecialty1 = new Specialty("Cut");

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

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

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

            //Assert
            CollectionAssert.AreEqual(expectedSpecialties, Specialties);
        }
Exemplo n.º 15
0
        public void Delete_DeleteSpecialtyProperly()
        {
            //Arrange
            Specialty newSpecialty1 = new Specialty("NotColor");

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

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

            //Act
            Specialty.Delete(newSpecialty1.Id);
            List <Specialty> Specialties = Specialty.GetAll();

            //Assert
            CollectionAssert.AreEqual(expectedSpecialties, Specialties);
        }
        public ActionResult Create()
        {
            List <Specialty> SpecialtyList = Specialty.GetAll();

            int flag = 0;

            foreach (Specialty Specialty in SpecialtyList)
            {
                if (Specialty.Name == Request.Form["newSpecialty"])
                {
                    flag++;
                }
            }
            if (flag == 0)
            {
                Specialty newSpecialty = new Specialty(Request.Form["newSpecialty"]);
                newSpecialty.Create();
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 17
0
        public void AddStylist_AddStylistExactly()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Cut");

            newSpecialty.Create();
            Stylist newStylist = new Stylist("Jane");

            newStylist.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylist
            };

            //Act
            newSpecialty.AddStylist(newStylist);
            List <Stylist> Stylists = newSpecialty.GetStylists();

            //Assert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
Exemplo n.º 18
0
        public void GetStylists_GetAllStylists_List()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Stuff");

            newSpecialty.Create();
            Stylist newStylist = new Stylist("Baxx");

            newStylist.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylist
            };

            newSpecialty.AddStylist(newStylist);

            //Act
            List <Stylist> Stylists = newSpecialty.GetStylists();

            //AssertAssert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
Exemplo n.º 19
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);
        }