public void Test5_GetAllClient_esInStylist_true() { Stylist myStylist = new Stylist("lo-main"); myStylist.Save(); Client firstClient = new Client("Pizza",myStylist.GetId()); firstClient.Save(); Client secondClient = new Client("tacos",myStylist.GetId()); secondClient.Save(); List<Client> testClientList = new List<Client> {firstClient,secondClient}; List<Client> resultClientList = myStylist.GetClient(); Assert.Equal(testClientList, resultClientList); }
public void Test4_FindId() { Stylist myStylist = new Stylist("kjoio",2); myStylist.Save(); Stylist findStylist = Stylist.Find(myStylist.GetId()); Assert.Equal(findStylist, myStylist); }
public void Test_Save_AssignsIdToObject() { // Arrange Stylist testStylist = new Stylist("Doc Gonzo", "Haircut"); // Act testStylist.Save(); Stylist savedStylist = Stylist.GetAll()[0]; int result = savedStylist.GetId(); int testId = testStylist.GetId(); // Assert Assert.Equal(testId, result); }
public void Test3_Save_ID_true() { Stylist myStylist = new Stylist ("sdojofdkoedf"); myStylist.Save(); //List return list of Stylist List<Stylist> allStylist= Stylist.GetAll(); Stylist oneStylist = allStylist[0]; int resultId= oneStylist.GetId(); int testId=myStylist.GetId(); Assert.Equal(resultId, testId); }
public override bool Equals(System.Object otherStylist) { if (!(otherStylist is Stylist)) { return(false); } else { Stylist newStylist = (Stylist)otherStylist; bool idEquality = this.GetId() == newStylist.GetId(); bool firstNameEquality = this.GetFirstName() == newStylist.GetFirstName(); bool lastNameEquality = this.GetLastName() == newStylist.GetLastName(); bool expertiseEquality = this.GetExpertise() == newStylist.GetExpertise(); return(idEquality && firstNameEquality && lastNameEquality && expertiseEquality); } }
public void T9_DeleteStylistClients_DeletesClientIfNoStylist() { Stylist testStylist = new Stylist("Clementine", "Clips", "L.4 Specialist"); testStylist.Save(); Client testClient = new Client("Shaggy", "Dew", testStylist.GetId()); testClient.Save(); testStylist.DeleteStylistClients(); testStylist.Delete(); List <Client> result = Client.GetAll(); int resultCount = result.Count; List <Client> testClients = new List <Client> { }; int testCount = testClients.Count; Assert.Equal(testCount, resultCount); }
public void Test_Delete_DeletesStylistFromDatabase() { //Arrange string stylistName1 = "Emmylou"; string specialty1 = "cut and color"; Stylist testStylist1 = new Stylist(stylistName1, specialty1); testStylist1.Save(); string stylistName2 = "Betty"; string specialty2 = "trim"; Stylist testStylist2 = new Stylist(stylistName2, specialty2); testStylist2.Save(); Client testClient1 = new Client("Minnie Mouse", "some details", testStylist1.GetId()); testClient1.Save(); Client testClient2 = new Client("Darla Darling", "here are some more details", testStylist2.GetId()); testClient2.Save(); //Act testStylist1.Delete(); List <Stylist> resultStylists = Stylist.GetAll(); List <Stylist> testStylistList = new List <Stylist> { testStylist2 }; List <Client> resultClients = Client.GetAll(); List <Client> testClientList = new List <Client> { testClient2 }; //Assert Assert.Equal(testStylistList, resultStylists); Assert.Equal(testClientList, resultClients); }
public void Test_Delete_DeletesStylistFromDatabase() { // Arrange string name = "Doctor Gonzo"; Stylist testStylist = new Stylist(name, "Cuts"); testStylist.Save(); string name2 = "Mouse"; Stylist testStylist2 = new Stylist(name2, "Brushes"); testStylist2.Save(); Client testClient = new Client("Sid", "Cut", testStylist.GetId()); testClient.Save(); Client testClient2 = new Client("Yousef", "Color", testStylist2.GetId()); testClient2.Save(); // Act testStylist.Delete(); List<Stylist> resultStylists = Stylist.GetAll(); List<Stylist> testStylistList = new List<Stylist> {testStylist2}; List<Client> resultClients = Client.GetAll(); List<Client> testClientList = new List<Client> {testClient2}; // Assert Assert.Equal(testStylistList, resultStylists); Assert.Equal(testClientList, resultClients); }
public void Test_Delete_Deletes_Stylist_FromDatabase() { //Arrange string name1 = "George"; Stylist testStylist1 = new Stylist(name1); testStylist1.Save(); string name2 = "Justin"; Stylist testStylist2 = new Stylist(name2); testStylist2.Save(); Client testClient1 = new Client("Dinese", testStylist1.GetId()); testClient1.Save(); Client testClient2 = new Client("Damian", testStylist2.GetId()); testClient2.Save(); //Act testStylist1.Delete(); List <Stylist> resultStylists = Stylist.GetAll(); List <Stylist> testStylistList = new List <Stylist> { testStylist2 }; List <Client> resultClients = Client.GetAll(); List <Client> testClientList = new List <Client> { testClient2 }; //Assert Assert.Equal(testStylistList, resultStylists); Assert.Equal(testClientList, resultClients); }
public void Test_Delete_DeletesStylistFromDatabase() { //Arrange string name1 = "french"; Stylist testStylist1 = new Stylist(name1); testStylist1.Save(); string name2 = "Thai"; Stylist testStylist2 = new Stylist(name2); testStylist2.Save(); Client testClient1 = new Client("jims place", testStylist1.GetId()); testClient1.Save(); Client testClient2 = new Client("pig ynakers ", testStylist2.GetId()); testClient2.Save(); //Act testStylist1.Delete(); List <Stylist> resultStylists = Stylist.GetAll(); List <Stylist> testStylistList = new List <Stylist> { testStylist2 }; List <Client> resultClients = Client.GetAll(); List <Client> testClientList = new List <Client> { testClient2 }; //Assert Assert.Equal(testStylistList, resultStylists); Assert.Equal(testClientList, resultClients); }
[Fact] //Spec 4 public void Test_GetClients_RetrievesAllClientsForStylist() { Stylist testStylist = new Stylist("Emmylou Earnest", "Men's cuts and short hair styles."); testStylist.Save(); Client firstClient = new Client("Darla Darling", "On her last visit (1/2/2013), we trimmed her hair and touched up her roots with dark drown.", testStylist.GetId()); firstClient.Save(); Client secondClient = new Client("Beau Blue", "On his last visit, we shaved his sides and trimmed the top.", testStylist.GetId()); secondClient.Save(); List <Client> testClientList = new List <Client> { firstClient, secondClient }; List <Client> resultClientList = testStylist.GetClients(); Assert.Equal(testClientList, resultClientList); }
public void Test7_Delete_OneStylist_true() { Stylist firstStylist = new Stylist("A"); firstStylist.Save(); Stylist secondStylist = new Stylist("B"); secondStylist.Save(); Client firstStylistClient = new Client("sddsds",firstStylist.GetId()); firstStylistClient.Save(); Client secondStylistDsih= new Client("dssdsdds",secondStylist.GetId()); secondStylistDsih.Save(); firstStylist.Delete(); List<Stylist> allStylists = Stylist.GetAll(); List<Stylist> afterDeleteOneStylist= new List<Stylist> {secondStylist}; List<Client> resultClient=Client.GetAll(); List<Client> afterDeleteOneStylistClient= new List<Client> {secondStylistDsih}; Assert.Equal(afterDeleteOneStylist,allStylists); Assert.Equal(afterDeleteOneStylistClient,resultClient); }