public void Edit_ChangesName_true() { //Arrange Stylist newStylist = new Stylist("Grace"); newStylist.Save(); //Act newStylist.Edit("Graysce"); Stylist foundStylist = Stylist.Find(newStylist.GetId()); //Assert Assert.Equal("Graysce", foundStylist.GetName()); }
public HomeModule() { Get["/"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/add"] = _ => { return(View["new-stylist-form.cshtml"]); }; Post["/stylist/add"] = _ => { Stylist newStylist = new Stylist(Request.Form["stylistName"]); newStylist.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/stylist/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return(View["stylist.cshtml", currentStylist]); }; Get["/client/add"] = _ => { List <Stylist> allStylists = Stylist.GetAll(); return(View["new-client-form.cshtml", allStylists]); }; Post["/client/add"] = _ => { Client newClient = new Client(Request.Form["clientName"], Request.Form["clientStylistId"]); newClient.Save(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Get["/client/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return(View["client.cshtml", currentClient]); }; Get["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); return(View["edit-stylist-form.cshtml", currentStylist]); }; Patch["/stylist/edit/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Edit(Request.Form["stylistName"]); return(View["stylist.cshtml", currentStylist]); }; Get["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); return(View["edit-client-form.cshtml", currentClient]); }; Patch["/client/edit/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); currentClient.Edit(Request.Form["clientName"], currentClient.GetStylistId()); return(View["client.cshtml", currentClient]); }; Delete["/stylist/delete/{id}"] = parameters => { Stylist currentStylist = Stylist.Find(parameters.id); currentStylist.Delete(); List <Stylist> allStylists = Stylist.GetAll(); return(View["index.cshtml", allStylists]); }; Delete["/client/delete/{id}"] = parameters => { Client currentClient = Client.Find(parameters.id); Stylist currentStylist = Stylist.Find(currentClient.GetStylistId()); currentClient.Delete(); return(View["stylist.cshtml", currentStylist]); }; }