public void Edit_UpdatesValues_true()
        {
            //Arrange
            Client newClient = new Client("client1", 2);

            newClient.Save();
            //Act
            newClient.Edit("Cliff", 1);
            Client foundClient    = Client.Find(newClient.GetId());
            Client expectedResult = new Client(newClient.GetName(), newClient.GetStylistId(), newClient.GetId());

            //Assert
            Assert.Equal(expectedResult, foundClient);
        }
Example #2
0
        public void Test_Update_UpdatesClientInDatabase()
        {
            string name       = "Joe";
            Client testClient = new Client(name, 1);

            testClient.Save();
            string newName = "Paul";

            testClient.Update(newName);

            string result = testClient.GetName();

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

            testClient.Save();
            string newName = "Nadroj Pool";

            testClient.Update(newName);

            string result = testClient.GetName();

            Assert.Equal(newName, result);
        }
        public void Update_UpdatesClientInDatabase()
        {
            //Arrange
            Client testCase = new Client("Hrothgar Gunnirson", 0);

            testCase.Save();
            string newName = "Joe Smith";

            //Act
            testCase.Update(newName);
            string actual = testCase.GetName();

            //Assert
            Assert.Equal(newName, actual);
        }
Example #5
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   stylistEquality = (this.GetStylistId() == newClient.GetStylistId());
         return(idEquality && nameEquality && stylistEquality);
     }
 }
Example #6
0
        public void Test_Update_UpdatesClientInDatabase()
        {
            string name       = "Bart";
            int    stylist_id = 2;
            Client testClient = new Client(name, stylist_id);

            testClient.Save();
            string newName = "Bartholomewchlewizkyzak";

            testClient.Update(newName);

            string result = testClient.GetName();

            Assert.Equal(newName, result);
        }
Example #7
0
        public void Test_FindClientFromStylist()
        {
            Stylist newStylist = new Stylist("Hilary", 1);

            newStylist.Save();

            Client controlClient = new Client("David", 1);

            controlClient.Save();

            Client newClient = Client.Find(controlClient.GetId());

            Console.WriteLine(newClient.GetName());

            Assert.Equal(controlClient.GetName(), newClient.GetName());
        }
Example #8
0
        public void Test_ChangeNameOfClient()
        {
            Client newClient = new Client("Hunter", 10);

            newClient.Save();

            Client testClient = Client.Find(newClient.GetId());

            testClient.Save();

            string newName = "Patrick";

            testClient.Update(newName);

            Assert.Equal(newName, testClient.GetName());
        }
        public void Update_UpdatesClientInDB()
        {
            //Arrange
            string name       = "John Mayer";
            Client testClient = new Client(name, 2);

            testClient.Save();
            string newName = "Hayley Williams is a Goddess";

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

            //Assert
            Assert.Equal(newName, result);
        }
Example #10
0
        public void Test_Update_UpdateClient()
        {
            //Arrange
            string name       = "Billy the Goat";
            Client testClient = new Client(name, 1);

            testClient.Save();
            string updateName = "Billy the Giraffe";

            //Act
            testClient.Update(updateName);
            string result = testClient.GetName();

            //Assert
            Assert.Equal(updateName, result);
        }
Example #11
0
        public void Client_UpdatesClientInDatabase()
        {
            string name       = "Dave";
            int    stylistId  = 1;
            Client testClient = new Client(name, stylistId);

            testClient.Save();
            string newName      = "David";
            int    newStylistId = 2;

            testClient.Update(newName, newStylistId);

            string result = testClient.GetName();

            Assert.Equal(newName, result);
        }
Example #12
0
        public HomeModule()
        {
            Get["/"] = _ => {
                return(View["index.cshtml"]);
            };
            Get["/Stylist"] = _ => {
                List <Stylist> AllStylist = Stylist.GetAll();
                return(View["Stylist.cshtml", AllStylist]);
            };
            Get["/Stylist/{id}"] = parameters => {
                List <Client> newClients = Client.FindList(parameters.id);
                Client        newClient  = new Client("FAKE", parameters.id);
                newClients.Add(newClient);
                return(View["StylistClients.cshtml", newClients]);
            };
            Get["/Stylist/Client/All"] = _ => {
                List <Client> allClients = Client.GetAll();
                return(View["AllClients.cshtml", allClients]);
            };
            Get["/Stylist/new"] = _ => {
                return(View["newStylist.cshtml"]);
            };

            Post["/Stylist/Success"] = _ => {
                Stylist newStylist = new Stylist(Request.Form["name"]);
                newStylist.Save();
                return(View["Success.cshtml"]);
            };

            Get["/Client/new/{id}"] = parameters => {
                List <Client> ClientList = Client.FindList(parameters.id);
                Client        newClient  = new Client("FAKE", parameters.id);
                ClientList.Add(newClient);
                List <Stylist> allStylist = Stylist.GetAll();
                return(View["newClient.cshtml", ClientList]);
            };

            Post["/Client/Success"] = _ => {
                Client newClient = new Client(Request.Form["name"], Request.Form["stylist"]);
                newClient.Save();
                return(View["Success.cshtml"]);
            };

            Delete["/deleted"] = _ => {
                Stylist.DeleteAll();
                List <Stylist> allStylist = Stylist.GetAll();
                return(View["Stylist.cshtml", allStylist]);
            };

            Delete["/deleted/{id}"] = parameters => {
                Client newClient = Client.Find(parameters.id);
                Client.Find(parameters.id).Delete();
                List <Stylist> allStylist = Stylist.GetAll();
                return(View["Stylist.cshtml", allStylist]);
            };

            Delete["/clients/deleted"] = _ => {
                Client.DeleteAll();
                return(View["Success.cshtml"]);
            };

            Get["/change/{id}"] = parameters => {
                Client newClient = Client.Find(parameters.id);
                return(View["change.cshtml", newClient]);
            };

            Patch["/change/success/{id}"] = parameters => {
                Client newClient = Client.Find(parameters.id);
                string Name      = Request.Form["changeName"];
                newClient.Update(Name);
                // newClient.Save();
                Client TestClient = Client.Find(newClient.GetId());
                Console.WriteLine(TestClient.GetName());
                return(View["index.cshtml"]);
            };
        }