public void GetStylists_Test()
        {
            //Arrange
            Speciality newSpeciality = new Speciality("Tom cruise style");

            newSpeciality.Save();
            Stylist newStylist = new Stylist("Swati", "senior stylist");

            newStylist.Save();
            Stylist newStylist1 = new Stylist("Rakesh", "senior stylist");

            newStylist1.Save();

            //Act
            newSpeciality.AddStylist(newStylist);
            newSpeciality.AddStylist(newStylist1);

            List <Stylist> expectedResult = new List <Stylist> {
                newStylist, newStylist1
            };
            List <Stylist> result = newSpeciality.GetStylists();

            //Assert
            CollectionAssert.AreEqual(expectedResult, result);
        }
Пример #2
0
        public ActionResult AddStylist(int specialityId, int stylistId)
        {
            Speciality speciality = Speciality.Find(specialityId);
            Stylist    stylist    = Stylist.Find(stylistId);

            speciality.AddStylist(stylist);
            return(RedirectToAction("Show", new { id = specialityId }));
        }
Пример #3
0
        public ActionResult AddStylist(int SpecialityId)
        {
            Speciality Speciality = Speciality.Find(SpecialityId);
            Stylist    stylist    = Stylist.Find(int.Parse(Request.Form["stylistid"]));

            Speciality.AddStylist(stylist);
            return(RedirectToAction("Detail", new { id = SpecialityId }));
        }
        public ActionResult AddStylist(int id, int stylistId)
        {
            Speciality newSpeciality = Speciality.Find(id);

            newSpeciality.AddStylist(Stylist.Find(stylistId));
            ViewBag.Stylists   = Stylist.GetAll();
            ViewBag.Speciality = Speciality.Find(id);
            ViewBag.Stylists1  = newSpeciality.GetStylists();

            return(View("Show"));
        }
Пример #5
0
        public void Test_AddStylist_AddsStylistToSpeciality()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            Stylist testStylist = new Stylist("Emmaline", "Has an experience in the beauty industry.");

            testStylist.Save();
            Stylist testStylist2 = new Stylist("Emma", "Has an experience in the beauty industry.");

            testStylist2.Save();
            testSpeciality.AddStylist(testStylist);
            testSpeciality.AddStylist(testStylist2);
            List <Stylist> result   = testSpeciality.GetStylists();
            List <Stylist> testList = new List <Stylist> {
                testStylist, testStylist2
            };

            CollectionAssert.AreEqual(testList, result);
        }
        public void GetStylists_ReturnSpecialityWithAllStylists()
        {
            Speciality newSpeciality = new Speciality("Hairmaster");

            newSpeciality.Save();
            Stylist newStylist = new Stylist("Roma", 3);

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

            newStylist1.Save();
            newSpeciality.AddStylist(newStylist);
            newSpeciality.AddStylist(newStylist1);

            List <Stylist> allStylists = new List <Stylist> {
                newStylist, newStylist1
            };
            List <Stylist> result = newSpeciality.GetStylists();

            CollectionAssert.AreEqual(allStylists, result);
        }
Пример #7
0
        public void Delete_DeletesSpecialityFromDatabase_SpecialityList()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            Stylist testStylist = new Stylist("Emmaline", "Has an experience in the beauty industry.");

            testStylist.Save();
            testSpeciality.AddStylist(testStylist);
            testSpeciality.Delete();
            List <Speciality> resultStylistSpecialities = testStylist.GetSpecialities();
            List <Speciality> testStylistSpecialities   = new List <Speciality> {
            };

            CollectionAssert.AreEqual(resultStylistSpecialities, testStylistSpecialities);
        }
Пример #8
0
        public void AddStylist_StylistIsAddedToJoinTable_True()
        {
            //Arrange
            Speciality specialityOne = new Speciality("Cutting");

            specialityOne.Save();
            Stylist stylistOne = new Stylist("Ryan");

            stylistOne.Save();

            //Act
            specialityOne.AddStylist(stylistOne);
            List <Stylist> allStylists = specialityOne.GetStylists();
            int            count       = allStylists.Count;

            //Assert
            Assert.AreEqual(1, count);
        }
Пример #9
0
        public void GetStylists_ReturnsAllSpecialityStylists_SpecialityList()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            Stylist testStylist = new Stylist("Emmaline", "Has an experience in the beauty industry.");

            testStylist.Save();
            Stylist testStylist2 = new Stylist("Emma", "Has an experience in the beauty industry.");

            testStylist2.Save();
            testSpeciality.AddStylist(testStylist);
            List <Stylist> savedStylists = testSpeciality.GetStylists();
            List <Stylist> testList      = new List <Stylist> {
                testStylist
            };

            CollectionAssert.AreEqual(testList, savedStylists);
        }