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 nameEquality = (this.GetName() == newStylist.GetName()); bool phoneNumberEquality = (this.GetPhoneNumber() == newStylist.GetPhoneNumber()); return(idEquality && nameEquality && phoneNumberEquality); } }
public void Test_Update_UpdatesStylistInDatabase() { //Arrange string name = "nancy"; Stylist testStylist = new Stylist(name); testStylist.Save(); string newName = "Thai"; //Act testStylist.Update(newName); string result = testStylist.GetName(); //Assert Assert.Equal(newName, result); }
public void Test_Updated_UpdatesStylistInDatabase() { // Arrange string name = "Doctor Gonzo"; Stylist testStylist = new Stylist(name, "Cuts"); testStylist.Save(); string newName = "Dr. Gonzo"; // Act testStylist.Update(newName); string result = testStylist.GetName(); // Assert Assert.Equal(newName, result); }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/clients/{id}"] = parameters => { List <Client> allClients = Client.GetAll(parameters.id); return(View["clients.cshtml", allClients]); }; Get["/client/{id}"] = parameters => { Client foundClient = Client.Find(parameters.id); return(View["client.cshtml", foundClient]); }; Get["/clients/add/{id}"] = parameters => { int model = parameters.id; return(View["add-client.cshtml", model]); }; Get["/stylist/update/{id}"] = parameters => { Stylist model = Stylist.Find(parameters.id); return(View["update-stylist.cshtml", model]); }; Get["/client/update/{id}"] = parameters => { Client model = Client.Find(parameters.id); return(View["update-client.cshtml", model]); }; Post["/stylist/delete/{id}"] = parameters => { Stylist newStylist = Stylist.Find(parameters.id); string name = newStylist.GetName(); Stylist.RemoveAStylist(parameters.id); return(View["stylist-deleted.cshtml", name]); }; Post["/client/delete/{id}"] = parameters => { Client newClient = Client.Find(parameters.id); string name = newClient.GetName(); Client.RemoveAClient(parameters.id); return(View["client-deleted.cshtml", name]); }; Post["/stylist-added"] = _ => { string name = Request.Form["name"]; string hours = Request.Form["hours"]; int phone = Request.Form["phone"]; Stylist newStylist = new Stylist(name, hours, phone); newStylist.Save(); return(View["stylist-added.cshtml", newStylist]); }; Post["/client-added/{id}"] = parameters => { string name = Request.Form["name"]; string hair_color = Request.Form["hair"]; int phone = Request.Form["phone"]; Client newClient = new Client(name, hair_color, phone, parameters.id); newClient.Save(); return(View["client-added.cshtml", newClient]); }; Post["/client-updated/{id}"] = parameters => { string name = Request.Form["name"]; string hair_color = Request.Form["hair"]; int phone = Request.Form["phone"]; Client.Update(name, hair_color, phone, parameters.id); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Post["/stylist-updated/{id}"] = parameters => { string name = Request.Form["name"]; string hours = Request.Form["hours"]; int phone = Request.Form["phone"]; Stylist.Update(name, hours, phone, parameters.id); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; }
public void Test6_Update_StylistInDatabase() { Stylist myStylist = new Stylist("befewfefwrg"); myStylist.Save(); myStylist.Update("er"); string result = myStylist.GetName(); Assert.Equal("er", result); }