public ActionResult AddSpecialities(int stylistId) { Stylist stylist = Stylist.Find(stylistId); Speciality specialities = Speciality.Find(Int32.Parse(Request.Form["speciality-id"])); stylist.AddSpecialities(specialities); return(RedirectToAction("Index")); }
public void GetSpecialities_ReturnsAllStylistSpecialities_SpecialityList() { //Arrange Stylist testStylist = new Stylist("Mel"); testStylist.Save(); Speciality testSpeciality = new Speciality("Cut"); testSpeciality.Save(); //Act testStylist.AddSpecialities(testSpeciality); List <Speciality> result = testStylist.GetSpecialities(); List <Speciality> testList = new List <Speciality> { testSpeciality }; //Assert CollectionAssert.AreEqual(testList, result); }
public void Delete_DeletesStylistAssociationsFromDatabase_StylistList() { //Arrange Speciality testSpeciality = new Speciality("Cut"); testSpeciality.Save(); Stylist testStylist = new Stylist("Mel"); testStylist.Save(); //Act testStylist.AddSpecialities(testSpeciality); testStylist.Delete(); List <Stylist> resultStylist = testSpeciality.GetStylists(); List <Stylist> testStylist2 = new List <Stylist> { }; //Assert CollectionAssert.AreEqual(testStylist2, resultStylist); }