Пример #1
0
        public void Test_AddClient_AddsClientToStylist()
        {
            //Arrange
            Stylist testStylist = new Stylist("Bob");

            testStylist.Save();

            Client testClient = new Client("Tom");

            testClient.Save();

            Client testClient2 = new Client("Tommy");

            testClient2.Save();

            //Act
            testStylist.AddClient(testClient);
            testStylist.AddClient(testClient2);

            List <Client> result   = testStylist.GetClients();
            List <Client> testList = new List <Client> {
                testClient, testClient2
            };

            //Assert
            CollectionAssert.AreEqual(testList, result);
        }
Пример #2
0
        public void AddClient_AddsClientToStylist_ClientList()
        {
            //Arrange
            Client testClient1 = new Client("Wu");

            testClient1.Save();
            Client testClient2 = new Client("Yu");

            testClient2.Save();

            System.DateTime hireDate     = System.DateTime.Parse("03/01/2018");
            Stylist         firstStylist = new Stylist("Kim", hireDate);

            firstStylist.Save();

            List <Client> testList = new List <Client> {
                testClient1, testClient2
            };

            //Act
            firstStylist.AddClient(testClient1);
            firstStylist.AddClient(testClient2);
            List <Client> result = firstStylist.GetClients();

            //Assert
            Assert.AreEqual(testList.Count, result.Count);
        }
Пример #3
0
        public void GetClients_ReturnsAllClientStylists_ClientList()
        {
            //Arrange
            Client testClient1 = new Client("Wu");

            testClient1.Save();
            Client testClient2 = new Client("Yu");

            testClient2.Save();

            System.DateTime hireDate     = System.DateTime.Parse("03/01/2018");
            Stylist         testStylist1 = new Stylist("Kim", hireDate);

            testStylist1.Save();

            //Act
            testStylist1.AddClient(testClient1);
            testStylist1.AddClient(testClient2);
            List <Client> result   = testStylist1.GetClients();
            List <Client> testList = new List <Client> {
                testClient1, testClient2
            };

            //Assert
            Assert.AreEqual(testList.Count, result.Count);
            // CollectionAssert.AreEqual(testList, result);
        }
Пример #4
0
        public void GetClients_ReturnAllClients_List()
        {
            //Arrange
            Stylist newStylist1 = new Stylist("Baz");

            newStylist1.Create();
            Client newClient1 = new Client("Pug", "182973");

            newClient1.Create();
            Client newClient2 = new Client("Pugna", "1829738192");

            newClient2.Create();
            newStylist1.AddClient(newClient1);
            newStylist1.AddClient(newClient2);
            List <string> expectedClients = new List <string> {
                newClient1.Name, newClient2.Name
            };

            //Act
            List <Client> allClients     = newStylist1.GetClients();
            List <String> allClientsName = new List <String> {
            };

            foreach (Client client in allClients)
            {
                allClientsName.Add(client.Name);
            }

            //Assert
            CollectionAssert.AreEqual(expectedClients, allClientsName);
        }
Пример #5
0
        public void GetClients_ReturnsAllStylistClients_ClientList()
        {
            //Arrange
            Stylist testStylist = new Stylist("Bob");

            testStylist.Save();

            Client testClient1 = new Client("Tom");

            testClient1.Save();

            Client testClient2 = new Client("Tommy");

            testClient2.Save();

            //Act
            testStylist.AddClient(testClient1);
            List <Client> savedClients = testStylist.GetClients();
            List <Client> testList     = new List <Client> {
                testClient1
            };

            //Assert
            CollectionAssert.AreEqual(testList, savedClients);
        }
Пример #6
0
        public IActionResult AddClient(int id, int addedClientId)
        {
            Stylist selectedStylist = Stylist.FindStylist(id);
            Client  selectedClient  = Client.FindClient(addedClientId);

            selectedStylist.AddClient(selectedClient);
            return(RedirectToAction("StylistInfo"));
        }
Пример #7
0
        public ActionResult NewClientRedirect(int id, string name)
        {
            Stylist newStylist = Stylist.Find(id);

            newStylist.AddClient(name);
            //return View(newStylist.GetId());
            return(RedirectToAction("Details", id));
        }
        public ActionResult AddClient(int Id)
        {
            Stylist stylist = Stylist.Find(Id);
            Client  client  = Client.Find(int.Parse(Request.Form["client-id"]));

            stylist.AddClient(client);
            return(RedirectToAction("Details", new { id = Id }));
        }
Пример #9
0
        public ActionResult AddClient(int stylistId, int clientId)
        {
            Stylist stylist = Stylist.Find(stylistId);
            Client  client  = Client.Find(clientId);

            stylist.AddClient(client);
            return(RedirectToAction("Show", new { id = stylistId }));
        }
Пример #10
0
        public ActionResult AddClient(int stylistId)
        {
            Stylist stylist = Stylist.Find(stylistId);
            Client  client  = Client.Find(Int32.Parse(Request.Form["client-id"]));

            stylist.AddClient(client);
            return(RedirectToAction("Success", "Home"));
        }
Пример #11
0
        public ActionResult AddStylistClient(int id)
        {
            Stylist newStylist = Stylist.Find(id);
            Client  newClient  = Client.Find(int.Parse(Request.Form["add-new-client"]));

            newStylist.AddClient(newClient);
            return(RedirectToAction("StylistInfo", new { id = id }));
        }
Пример #12
0
        public ActionResult AddClient(int StylistId, int clientId)
        {
            Stylist foundStylist = Stylist.Find(StylistId);
            Client  foundClient  = Client.Find(clientId);

            foundStylist.AddClient(foundClient);
            return(RedirectToAction("Details", new { StylistId = foundStylist.id }));
        }
Пример #13
0
        public ActionResult AddForm(int id)
        {
            Stylist foundStylist = Stylist.Find(id);
            Client  newClient    = new Client(Request.Form["clientsName"], id);

            newClient.Save();
            foundStylist.AddClient(newClient);
            return(RedirectToAction("Details", "Stylists"));
        }
        public ActionResult AddClient(int id)
        {
            Stylist thisStylist = Stylist.Find(id);
            Client  newClient   = new Client(Request.Form["inputClient"]);

            newClient.Save();
            thisStylist.AddClient(newClient);
            return(RedirectToAction("StylistDetails"));
        }
Пример #15
0
        public ActionResult Create(string clientName, int id)
        {
            Stylist stylist = Stylist.Find(id);

            Client client = new Client(clientName);

            stylist.AddClient(client);

            return(RedirectToAction("Show"));
        }
Пример #16
0
        public void Test_AddClient_AddsClientToStylist()
        {
            Stylist testStylist = new Stylist("Atom");

            testStylist.Save();
            Client testClient = new Client("Alex", "test");

            testClient.Save();
            Client testClient2 = new Client("Test", "test");

            testClient2.Save();
            testStylist.AddClient(testClient);
            testStylist.AddClient(testClient2);
            List <Client> result   = testStylist.GetClients();
            List <Client> testList = new List <Client> {
                testClient, testClient2
            };

            CollectionAssert.AreEqual(testList, result);
        }
Пример #17
0
        public void GetClients_ReturnStylistWithAllClients()
        {
            Stylist newStylist = new Stylist("Sorianna");

            newStylist.Save();
            Client newClient  = new Client("Lisa", new DateTime(2002, 2, 4));
            Client newClient1 = new Client("Lisa", new DateTime(2002, 2, 19));

            newClient.Save();
            newClient1.Save();
            newStylist.AddClient(newClient);
            newStylist.AddClient(newClient1);

            List <Client> allStylistsClients = new List <Client> {
                newClient, newClient1
            };
            List <Client> result = newStylist.GetClients();

            CollectionAssert.AreEqual(allStylistsClients, result);
        }
Пример #18
0
        public void Test_AddClient_AddsClientToStylist()
        {
            Stylist testStylist = new Stylist("Emmaline", "Has an experience in the beauty industry.");

            testStylist.Save();
            Client testClient = new Client("Lana", "Hair coloring", new DateTime(1 / 2 / 2019));

            testClient.Save();
            Client testClient2 = new Client("Ivan", "Hair cut", new DateTime(1 / 2 / 2019));

            testClient2.Save();
            testStylist.AddClient(testClient);
            testStylist.AddClient(testClient2);
            List <Client> result   = testStylist.GetClients();
            List <Client> testList = new List <Client> {
                testClient, testClient2
            };

            CollectionAssert.AreEqual(testList, result);
        }
        public ActionResult StylistClient(int stylistId)
        {
            // Console.WriteLine("Beginning of StylistSpecialty method, the stylist id is:" + stylistId);
            Stylist thisStylist = Stylist.Find(stylistId);

            // Console.WriteLine("special id is: " + Request.Form["specialty-id"]);
            Client newClient = Client.Find(Int32.Parse(Request.Form["client-id"]));

            thisStylist.AddClient(newClient);

            return(RedirectToAction("StylistDetail", new { id = stylistId }));
        }
        public ActionResult Create(int stylistId, string name, string styleNotes, double stylePrice, string dateJoin)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Stylist foundStylist = Stylist.Find(stylistId);
            Client  foundClient  = new Client(stylistId, name, styleNotes, stylePrice, dateJoin);

            foundStylist.AddClient(foundClient);
            List <Client> stylistClients = foundStylist.Clients;

            model.Add("clients", stylistClients);
            model.Add("stylist", foundStylist);
            return(View("Show", model));
        }
Пример #21
0
        public ActionResult Create(int id)
        {
            ViewBag.StylistId = id;
            string name      = Request.Form["clientName"];
            string number    = Request.Form["clientNumber"];
            Client newClient = new Client(name, number);

            newClient.Save();
            Stylist thisStylist = Stylist.Find(id);

            thisStylist.AddClient(newClient);
            return(RedirectToAction("Info", "Stylists", new { id = id }));
        }
        public ActionResult AddClient(int id, int clientId)
        {
            Stylist newStylist = Stylist.Find(id);

            newStylist.AddClient(Client.Find(clientId));
            ViewBag.Clients       = Client.GetAll();
            ViewBag.Specialities  = Speciality.GetAll();
            ViewBag.Stylist       = Stylist.Find(id);
            ViewBag.Clients1      = newStylist.GetClients();
            ViewBag.Specialities1 = newStylist.GetSpecialities();

            return(View("Show"));
        }
        public ActionResult CreateClient(int stylistId)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Stylist newStylist = Stylist.Find(stylistId);
            Client  newClient  = new Client(Request.Form["new-client"]);

            newClient.Save();
            newStylist.AddClient(newClient);
            List <Client> stylistClient = newStylist.GetClient();

            model.Add("client", stylistClient);
            model.Add("stylist", newStylist);
            return(RedirectToAction("Index", new{ id = stylistId }));
        }
Пример #24
0
        public void GetClients_FindsAllClientsInDatabase_ClientList()
        {
            Stylist testClass = new Stylist("Warlock", 0);

            testClass.Save();

            Client testClient = new Client("Betty");

            testClient.Save();

            testClass.AddClient(testClient);

            Assert.AreEqual(testClient, testClass.GetClients()[0]);
        }
Пример #25
0
        public void AddClient_LinksStylistWithClient_Stylist()
        {
            Stylist testClass = new Stylist("Warlock", 0);

            testClass.Save();

            Client testClient = new Client("Betty");

            testClient.Save();

            testClass.AddClient(testClient);

            Assert.AreEqual(testClient, testClass.GetClients()[0]);
        }
Пример #26
0
        public ActionResult CreateClient(int id, string newClientName) //from create client form
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Stylist foundStylist = Stylist.Find(id);
            Client  newClient    = new Client(newClientName, id);

            newClient.Save();
            foundStylist.AddClient(newClient);
            List <Client> stylistClients = foundStylist.GetClients();

            model.Add("clients", stylistClients);
            model.Add("stylists", foundStylist);
            return(View("Details", model));
        }
Пример #27
0
        public ActionResult Add(int id, string client_name)
        {
            Client addClient;

            // int addClientInt = int.Parse(clientId);
            addClient = new Client(client_name);
            addClient.Save();

            Stylist foundStylist = Stylist.Find(id);

            foundStylist.AddClient(addClient);

            return(RedirectToAction("Details", new { id = foundStylist.Id }));
        }
Пример #28
0
        public ActionResult Create(int stylistId, string clientName)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            Stylist foundStylist = Stylist.Find(stylistId);
            Client  newClient    = new Client(clientName, stylistId);

            newClient.Save();
            foundStylist.AddClient(newClient);
            List <Client> stylistClients = foundStylist.GetClients();

            model.Add("clients", stylistClients);
            model.Add("stylist", foundStylist);
            return(View("Show", model));
        }
Пример #29
0
        public void Found_Client_From_Stylist()
        {
            //Arrange
            Stylist firstStylist = new Stylist("Sam");

            //Act
            firstStylist.Save();
            firstStylist.AddClient("Jerry");
            List <Client> clients = firstStylist.GetClients();


            //Assert
            Assert.AreEqual("Jerry", clients[0].GetName());
        }
Пример #30
0
        public void RemoveClient_SeparateStylistClient_Stylist()
        {
            Stylist testClass = new Stylist("Vidal");

            testClass.Save();

            Client testClient = new Client("Tyra");

            testClient.Save();

            testClass.AddClient(testClient);
            testClass.RemoveClient(testClient);

            Assert.AreEqual(0, testClass.GetClients().Count);
        }