Example #1
0
        public void Equals_ReturnsTrueIfStylistsAreSame_Stylist()
        {
            StylistClass newStylist  = new StylistClass("Stylist9", "9", 9);
            StylistClass newStylist2 = new StylistClass("Stylist9", "9", 9);

            Assert.AreEqual(newStylist, newStylist2);
        }
Example #2
0
        public ActionResult Create(string name, string phoneNumber)
        {
            StylistClass stylist = new StylistClass(name, phoneNumber);

            stylist.Save();
            return(RedirectToAction("Index"));
        }
Example #3
0
        public void GetAll_ReturnsEmptyList_StylistList()
        {
            List <StylistClass> result  = StylistClass.GetAll();
            List <StylistClass> newList = new List <StylistClass>();

            CollectionAssert.AreEqual(newList, result);
        }
Example #4
0
        public void GetName_ReturnsName_String()
        {
            string       name       = "Name1";
            StylistClass newStylist = new StylistClass(name, "1", 1);
            string       result     = newStylist.GetName();

            Assert.AreEqual(name, result);
        }
Example #5
0
        public void GetPhoneNumber_ReturnsPhoneNumber_String()
        {
            string       phoneNumber = "1";
            StylistClass newStylist  = new StylistClass("Stylist9", "1", 9);
            string       result      = newStylist.GetPhoneNumber();

            Assert.AreEqual(phoneNumber, result);
        }
Example #6
0
        public void New_ReturnsCorrectView_True()
        {
            ClientsController controller = new ClientsController();
            StylistClass      stylist    = new StylistClass("Stylist1", "1", 1);
            ActionResult      newView    = controller.New(1);

            Assert.IsInstanceOfType(newView, typeof(ViewResult));
        }
        public ActionResult AddStylist(int specialtyId, int stylistId)
        {
            SpecialtyClass specialty = SpecialtyClass.Find(specialtyId);
            StylistClass   stylist   = StylistClass.Find(stylistId);

            specialty.AddStylist(stylist);
            return(RedirectToAction("Show", new { id = specialtyId }));
        }
        public void Show_ReturnsCorrectView_True()
        {
            StylistsController controller = new StylistsController();
            StylistClass       stylist    = new StylistClass("Stylist1", "1", 1);
            ActionResult       showView   = controller.Show(1);

            Assert.IsInstanceOfType(showView, typeof(ViewResult));
        }
Example #9
0
        public void GetClients_ReturnsEmptyList_ClientList()
        {
            StylistClass       newStylist = new StylistClass("Stylist9", "9", 9);
            List <ClientClass> newList    = new List <ClientClass>();

            List <ClientClass> result = newStylist.GetClients();

            CollectionAssert.AreEqual(newList, result);
        }
        public void Show_HasCorrectModelType_Stylist()
        {
            StylistsController controller = new StylistsController();
            StylistClass       stylist    = new StylistClass("Stylist1", "1", 1);
            ViewResult         showView   = controller.Show(1) as ViewResult;
            var result = showView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Dictionary <string, object>));
        }
Example #11
0
        public void Edit_ReturnsCorrectView_True()
        {
            ClientsController controller = new ClientsController();
            StylistClass      stylist    = new StylistClass("Stylist1", "1", 1);
            ClientClass       client     = new ClientClass("Client1", "1", 1, 1);
            ActionResult      showView   = controller.Edit(1, 1);

            Assert.IsInstanceOfType(showView, typeof(ViewResult));
        }
Example #12
0
        public void New_CorrectModelType_Stylist()
        {
            ClientsController controller = new ClientsController();
            StylistClass      stylist    = new StylistClass("Stylist", "1", 1);
            ViewResult        newView    = controller.New(1) as ViewResult;
            var result = newView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(StylistClass));
        }
Example #13
0
        public ActionResult Show(int stylistId, int clientId)
        {
            ClientClass client = ClientClass.Find(clientId);
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist = StylistClass.Find(stylistId);

            model.Add("client", client);
            model.Add("stylist", stylist);
            return(View(model));
        }
Example #14
0
        public ActionResult Edit(int stylistId, int specialtyId)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist   = StylistClass.Find(stylistId);
            StylistClass specialty = StylistClass.Find(specialtyId);

            model.Add("specialty", specialty);
            model.Add("stylist", stylist);
            return(View(model));
        }
Example #15
0
        public void Edit_HasCorrectModelType_Dictionary()
        {
            ClientsController controller = new ClientsController();
            StylistClass      stylist    = new StylistClass("Stylist", "1", 1);
            ClientClass       client     = new ClientClass("Client1", "1", 1, 1);
            ViewResult        newView    = controller.Edit(1, 1) as ViewResult;
            var result = newView.ViewData.Model;

            Assert.IsInstanceOfType(result, typeof(Dictionary <string, object>));
        }
Example #16
0
        public void SetPhoneNumber_SetsPhoneNumber_String()
        {
            StylistClass newStylist = new StylistClass("Stylist9", "9", 9);

            string newPhoneNumber = "9";

            newStylist.SetPhoneNumber(newPhoneNumber);
            string result = newStylist.GetPhoneNumber();

            Assert.AreEqual(newPhoneNumber, result);
        }
Example #17
0
        public ActionResult Destroy(int stylistId, int clientId)
        {
            ClientClass.Find(clientId).Delete();
            StylistClass                foundStylist   = StylistClass.Find(stylistId);
            List <ClientClass>          stylistClients = foundStylist.GetClients();
            Dictionary <string, object> model          = new Dictionary <string, object>();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
        public ActionResult Show(int id)
        {
            SpecialtyClass              specialty   = SpecialtyClass.Find(id);
            List <StylistClass>         stylists    = specialty.GetStylists();
            List <StylistClass>         allStylists = StylistClass.GetAll();
            Dictionary <string, object> model       = new Dictionary <string, object>();

            model.Add("specialty", specialty);
            model.Add("stylists", stylists);
            model.Add("allStylists", allStylists);
            return(View(model));
        }
Example #19
0
        public ActionResult Update(int stylistId, int clientId, string name, string phoneNumber)
        {
            ClientClass client = ClientClass.Find(clientId);

            client.Edit(name, phoneNumber);
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass stylist = StylistClass.Find(stylistId);

            model.Add("stylist", stylist);
            model.Add("client", client);
            return(View("Show", model));
        }
Example #20
0
        public ActionResult Update(int stylistId, string newName, string newPhoneNumber)
        {
            StylistClass stylist = StylistClass.Find(stylistId);

            stylist.Edit(newName, newPhoneNumber);
            Dictionary <string, object> model              = new Dictionary <string, object>();
            List <ClientClass>          stylistClients     = stylist.GetClients();
            List <SpecialtyClass>       stylistSpecialties = stylist.GetSpecialties();

            model.Add("stylist", stylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
Example #21
0
        public ActionResult AddSpecialty(int specialtyId, int stylistId)
        {
            //Dictionary<string, object> model = new Dictionary<string, object>();
            StylistClass foundStylist = StylistClass.Find(stylistId);
            // List<SpecialtyClass> allSpecialties = SpecialtyClass.GetAll();
            List <SpecialtyClass> stylistSpecialties = foundStylist.GetSpecialties();
            SpecialtyClass        specialtyStylist   = SpecialtyClass.Find(specialtyId);

            foundStylist.AddSpecialty(specialtyStylist);
            // model.Add("specialtyStylist", specialtyStylist);
            // model.Add("stylist", foundStylist);
            //model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new { id = stylistId }));
        }
Example #22
0
        public ActionResult Show(int id)
        {
            Dictionary <string, object> model        = new Dictionary <string, object>();
            StylistClass          foundStylist       = StylistClass.Find(id);
            List <ClientClass>    stylistClients     = foundStylist.GetClients();
            List <SpecialtyClass> allSpecialties     = SpecialtyClass.GetAll();
            List <SpecialtyClass> stylistSpecialties = foundStylist.GetSpecialties();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", allSpecialties);
            model.Add("stylistSpecialties", stylistSpecialties);
            return(View("Show", model));
        }
Example #23
0
        public ActionResult Create(int stylistId, string name, string phoneNumber)
        {
            Dictionary <string, object> model = new Dictionary <string, object>();
            StylistClass foundStylist         = StylistClass.Find(stylistId);
            ClientClass  newClient            = new ClientClass(name, phoneNumber, stylistId);

            newClient.Save();
            List <ClientClass>    stylistClients     = foundStylist.GetClients();
            List <SpecialtyClass> stylistSpecialties = SpecialtyClass.GetAll();

            model.Add("stylist", foundStylist);
            model.Add("clients", stylistClients);
            model.Add("specialties", stylistSpecialties);
            return(RedirectToAction("Show", new{ id = stylistId }));
        }
Example #24
0
 public ActionResult DeleteAll()
 {
     StylistClass.ClearAll();
     return(View());
 }
Example #25
0
 public ActionResult Destroy(int stylistId)
 {
     StylistClass.Find(stylistId).Delete();
     return(RedirectToAction("Index"));
 }
Example #26
0
        public void StylistConstructor_CreatesInstanceOfStylist_Stylist()
        {
            StylistClass newStylist = new StylistClass("Stylist1", "1", 1);

            Assert.AreEqual(typeof(StylistClass), newStylist.GetType());
        }
Example #27
0
 public void Dispose()
 {
     StylistClass.ClearAll();
     ClientClass.ClearAll();
 }
Example #28
0
        public ActionResult Index()
        {
            List <StylistClass> allStylists = StylistClass.GetAll();

            return(View(allStylists));
        }
 public void Dispose()
 {
     SpecialtyClass.ClearAll();
     ClientClass.ClearAll();
     StylistClass.ClearAll();
 }
Example #30
0
        public ActionResult New(int stylistId)
        {
            StylistClass stylist = StylistClass.Find(stylistId);

            return(View(stylist));
        }