Example #1
0
        public void Test6_Update_ClientInDatabase()
        {
            Client oneClient = new Client("erere", 13);
              oneClient.Save();
              oneClient.Update("q");
              string result = oneClient.GetName();

              Assert.Equal("q", result);
        }
Example #2
0
        public void Test_Update_UpdatesClientInDatabase()
        {
            string name       = "Billy Joe";
            int    id         = 1;
            Client testClient = new Client(name, id);

            testClient.Save();
            string newName = "Billy Joel";

            testClient.Update(newName);
            string result = testClient.GetName();

            Assert.Equal(newName, result);
        }
Example #3
0
        public void Test_UpdatesClient_In_Database()
        {
            string name       = "Dwight";
            Client testClient = new Client(name, 1);

            testClient.Save();

            string newName = "Douglas";

            testClient.Update(newName);
            string result = testClient.GetName();

            Assert.Equal(newName, result);
        }
Example #4
0
 public override bool Equals(System.Object otherClient)
 {
     if (!(otherClient is Client))
     {
         return(false);
     }
     else
     {
         Client newClient         = (Client)otherClient;
         bool   idEquality        = (this.GetId() == newClient.GetId());
         bool   nameEquality      = (this.GetName() == newClient.GetName());
         bool   stylistIdEquality = (this.GetStylistId() == newClient.GetStylistId());
         return(idEquality && nameEquality && stylistIdEquality);
     }
 }
Example #5
0
 public void Update_UpdatesAClient_ClientUpdated()
 {
     // Arrange
       string name1 = "Doc Gonzo";
       string service1 = "Fur";
       Client testClient1 = new Client(name1, service1, 1);
       testClient1.Save();
       string name2 = "Doctor Gonzo";
       string nameExpected = name2;
       // Act
       testClient1.Update(name2);
       string nameResult = testClient1.GetName();
       // Assert
       Assert.Equal(nameExpected, nameResult);
 }
Example #6
0
        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]);
            };
        }