public ActionResult AddStylist(int specialtyId, int stylistId) { StylistSpecialty newPair = new StylistSpecialty(stylistId, specialtyId); newPair.Save(); return(RedirectToAction("Detail", new { id = specialtyId })); }
public void SaveAndGetAll_SavesToDatabaseAndReturnAll_StylistSpecialty() { //Arrange StylistSpecialty testStylistSpecialty = new StylistSpecialty(1, 1); //Act testStylistSpecialty.Save(); List <StylistSpecialty> result = StylistSpecialty.GetAll(); List <StylistSpecialty> testList = new List <StylistSpecialty> { testStylistSpecialty }; //Assert CollectionAssert.AreEqual(testList, result); }
public void Save_AssignsIdToObject_Id() { //Arrange StylistSpecialty testStylistSpecialty = new StylistSpecialty(1, 1); //Act testStylistSpecialty.Save(); StylistSpecialty savedStylistSpecialty = StylistSpecialty.GetAll()[0]; int result = savedStylistSpecialty.GetId(); int testId = testStylistSpecialty.GetId(); //Assert Assert.AreEqual(testId, result); }
public void RemoveSpecialty_DeleteStylistFromStylist_SpecialtyTable_Stylist() { // Arrange Stylist testStylist = new Stylist("testName", 1); testStylist.Save(); Specialty testSpecialty = new Specialty("testSpecialty"); testSpecialty.Save(); StylistSpecialty testStylistSpecialty = new StylistSpecialty(testStylist.GetId(), testSpecialty.GetId()); testStylistSpecialty.Save(); // Act testStylist.RemoveSpecialty(testSpecialty.GetId()); // Assert Assert.AreEqual(0, testSpecialty.GetStylists().Count); }
public void Delete_DeleteStylistFromDatabaseAndStylist_SpecialtyTable_Stylist() { // Arrange Stylist testStylist = new Stylist("testName", 1); testStylist.Save(); Specialty testSpecialty = new Specialty("testSpecialty"); testSpecialty.Save(); StylistSpecialty testStylistSpecialty = new StylistSpecialty(testStylist.GetId(), testSpecialty.GetId()); testStylistSpecialty.Save(); // Act testStylist.Delete(); // Assert Assert.AreEqual(0, Stylist.Find(testStylist.GetId()).GetId()); Assert.AreEqual(0, testSpecialty.GetStylists().Count); }
public void GetStylists_RetrievesAllStylistsWithSpecialtyId_StylistList() { // Arrange Specialty testSpecialty = new Specialty("testSpecialty"); testSpecialty.Save(); Stylist testStylist = new Stylist("testStylist"); testStylist.Save(); StylistSpecialty testStylistSpecialty = new StylistSpecialty(testStylist.GetId(), testSpecialty.GetId()); testStylistSpecialty.Save(); List <Stylist> testStylists = new List <Stylist> { testStylist }; // Act List <Stylist> resultStylists = testSpecialty.GetStylists(); // Assert CollectionAssert.AreEqual(testStylists, resultStylists); }
public void GetSpecialties_RetrievesAllSpecialtiesWithStylistId_SpecialtyList() { // Arrange Stylist testStylist = new Stylist("testStylist"); testStylist.Save(); Specialty testSpecialty = new Specialty("testSpecialty"); testSpecialty.Save(); StylistSpecialty testStylistSpecialty = new StylistSpecialty(testStylist.GetId(), testSpecialty.GetId()); testStylistSpecialty.Save(); List <Specialty> testSpecialties = new List <Specialty> { testSpecialty }; // Act List <Specialty> resultSpecialties = testStylist.GetSpecialties(); // Assert CollectionAssert.AreEqual(testSpecialties, resultSpecialties); }