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")); }
[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); }
[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); }
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); }
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); }
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)); } }
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); }
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); }
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); }
[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); }
[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); }
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); }
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); }
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")); }
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); }
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); }
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); }