Example #1
0
        public void StylistADDGET_AddSpecialtyAndReturnThem_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Stylist newStylist1 = new Stylist("Joes", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Mandy", 30, Convert.ToDateTime("2018-02-02"));

            newStylist2.Create();
            Specialty newSpecialty = new Specialty("Mens");

            newSpecialty.Create();

            newStylist1.AddSpecialty(newSpecialty.Id);
            newStylist2.AddSpecialty(newSpecialty.Id);

            List <Stylist> testList = new List <Stylist> {
            };

            testList.Add(newStylist1);
            testList.Add(newStylist2);

            List <Stylist> resultList = newSpecialty.GetStylists();

            Assert.AreEqual(testList[0].Id, resultList[0].Id);
            Assert.AreEqual(testList[0].Name, resultList[0].Name);
            Assert.AreEqual(testList[1].Id, resultList[1].Id);
            Assert.AreEqual(testList[1].Name, resultList[1].Name);
        }
Example #2
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);
        }
Example #3
0
        public void GetStylists_GetAllStylistsCorrectly()
        {
            //Arrange
            Client testClient = new Client("bobz", "10927312");

            testClient.Create();
            Stylist newStylists1 = new Stylist("Buz");

            newStylists1.Create();
            Stylist newStylists2 = new Stylist("Biz");

            newStylists2.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylists1, newStylists2
            };

            testClient.AddStylist(newStylists1);
            testClient.AddStylist(newStylists2);

            //Act
            List <Stylist> Stylists = testClient.GetStylists();

            //Assert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
        public ActionResult StylistCreate(string newName, int newPay, string newStartDate)
        {
            Stylist newStylist = new Stylist(newName, newPay, Convert.ToDateTime(newStartDate));

            newStylist.Create();
            return(RedirectToAction("Index"));
        }
Example #5
0
        public void Create_StylistAddedCorrectly_True()
        {
            Stylist newStylist = new Stylist("Jose");

            newStylist.Create();

            Stylist test = Stylist.GetAll() [0];

            Assert.AreEqual(newStylist.Name, test.Name);
        }
Example #6
0
        [TestMethod] // test to see if find function returns proper stylist
        public void Find_FindStylist_Name()
        {
            Stylist.ClearAll();
            Stylist newStylist1 = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist test = Stylist.Find(newStylist1.Id);

            Assert.AreEqual("Jose", test.Name);
        }
Example #7
0
        [TestMethod] // test to see if .Create and is creating in DB
        public void Create_StylistAddedCorrectly_True()
        {
            Stylist.ClearAll();
            Stylist newStylist = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist.Create();

            Stylist test = Stylist.GetAll()[0];

            Assert.AreEqual("Jose", test.Name);
        }
Example #8
0
        public void Update_ChangeStylistNameCorrectly_True()
        {
            Stylist newStylist = new Stylist("Joes", 30, Convert.ToDateTime("2018-02-02"));
            string  testName   = "Jose";

            newStylist.Create();
            newStylist.Update(testName, 20);
            Stylist result = Stylist.Find(newStylist.Id);

            Assert.AreEqual(20, result.Wage);
            Assert.AreEqual(testName, result.Name);
        }
Example #9
0
        public void Update_ChangeStylistNameCorrectly_True()
        {
            Stylist newStylist = new Stylist("Rose");

            newStylist.Create();
            Console.WriteLine(newStylist.Id);
            newStylist.Update("Lilly");

            Stylist result = Stylist.GetAll() [0];

            Assert.AreEqual("Lilly", newStylist.Name);
        }
Example #10
0
        [TestMethod] // test to see if getall returns all lines in DB
        public void GetAll_GetAllStylists_Int()
        {
            Stylist.ClearAll();
            Stylist newStylist1 = new Stylist("Jose", 30, Convert.ToDateTime("2018-02-02"));

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Maggie", 22, Convert.ToDateTime("2015-02-02"));

            newStylist2.Create();
            Stylist newStylist3 = new Stylist("Fred", 14, Convert.ToDateTime("2013-02-02"));

            newStylist3.Create();
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(result, 3);
        }
Example #11
0
        public void RemoveClient_CorrectlyRemoveClientFromStylist()
        {
            Client newClient = new Client("Skye", "18923182");

            newClient.Create();
            List <Client> test = new List <Client> {
            };
            Stylist newStylist = new Stylist("Baz");

            newStylist.Create();
            newStylist.AddClient(newClient);
            newStylist.RemoveClient(newClient.Id);
            List <Client> allClients = newStylist.GetClients();

            CollectionAssert.Equals(test, allClients);
        }
        public ActionResult CreateStylist(int specialtyId)
        {
            if (Request.Method == "POST")
            {
                Stylist newStylist = new Stylist(Request.Form["newStylist"]);
                newStylist.Create();
                Specialty selectedSpecialty = Specialty.Find(specialtyId);

                selectedSpecialty.AddStylist(newStylist);
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(specialtyId));
            }
        }
Example #13
0
        public void ClearAll_DeleteAllCusines_Int()
        {
            Stylist newStylist1 = new Stylist("Lilly");

            newStylist1.Create();
            Stylist newStylist2 = new Stylist("Doug");

            newStylist2.Create();
            Stylist.ClearAll();
            Stylist newStylist5 = new Stylist("Rose");

            newStylist5.Create();
            int result = Stylist.GetAll().Count;

            Assert.AreEqual(result, 1);
        }
Example #14
0
        public void RemoveSpecialty_CorrectlyRemoveSpecialtyFromStylist()
        {
            Specialty newSpecialty = new Specialty("Color");

            newSpecialty.Create();
            List <Specialty> test = new List <Specialty> {
            };
            Stylist newStylist    = new Stylist("Baz");

            newStylist.Create();
            newStylist.AddSpecialty(newSpecialty);
            newStylist.RemoveSpecialty(newSpecialty.Id);
            List <Specialty> allspecialtys = newStylist.GetSpecialties();

            CollectionAssert.Equals(test, allspecialtys);
        }
Example #15
0
        public void AddStylist_AddsStylistToClient_StylistList()
        {
            Client testClient = new Client("Skye", "001283913");

            testClient.Create();

            Stylist testStylist = new Stylist("Bob");

            testStylist.Create();

            testClient.AddStylist(testStylist);
            List <Stylist> result   = testClient.GetStylists();
            List <Stylist> testList = new List <Stylist> {
                testStylist
            };

            CollectionAssert.AreEqual(testList, result);
        }
Example #16
0
        public void Delete_DeletesClientAssociationsFromDatabase_ClientList()
        {
            Stylist testStylist = new Stylist("Bob");

            testStylist.Create();

            Client testClient = new Client("Cow", "172378");

            testClient.Create();
            testClient.AddStylist(testStylist);
            Client.Delete(testClient.Id);

            List <Client> resultStylistClients = testStylist.GetClients();
            List <Client> testStylistClients   = new List <Client> {
            };

            //Assert
            CollectionAssert.AreEqual(testStylistClients, resultStylistClients);
        }
Example #17
0
        public void AddClient_AddAClientProperly()
        {
            //Arrange
            Stylist newStylist = new Stylist("Foo");

            newStylist.Create();
            Client newClient = new Client("Skye", "172361");

            newClient.Create();
            List <Client> expectedClients = new List <Client> {
                newClient
            };

            //Act
            newStylist.AddClient(newClient);
            List <Client> allClients = newStylist.GetClients();

            //Assert
            Assert.AreEqual(expectedClients.Count, allClients.Count);
        }
Example #18
0
        public void AddStylists_AddStylistsCorrectly()
        {
            //Arrange
            Client testClient = new Client("foo", "12983712");

            testClient.Create();
            Stylist newStylist = new Stylist("Bazzzzy");

            newStylist.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylist
            };

            //Act
            testClient.AddStylist(newStylist);
            List <Stylist> Stylists = testClient.GetStylists();

            //Assert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
Example #19
0
        public void AddStylist_AddStylistExactly()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Cut");

            newSpecialty.Create();
            Stylist newStylist = new Stylist("Jane");

            newStylist.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylist
            };

            //Act
            newSpecialty.AddStylist(newStylist);
            List <Stylist> Stylists = newSpecialty.GetStylists();

            //Assert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
Example #20
0
        public ActionResult Create()
        {
            List <Stylist> StylistList = Stylist.GetAll();

            int flag = 0;

            foreach (Stylist Stylist in StylistList)
            {
                if (Stylist.Name == Request.Form["newStylist"])
                {
                    flag++;
                }
            }
            if (flag == 0)
            {
                Stylist newStylist = new Stylist(Request.Form["newStylist"]);
                newStylist.Create();
            }
            return(RedirectToAction("Index"));
        }
Example #21
0
        public void GetStylists_GetAllStylists_List()
        {
            //Arrange
            Specialty newSpecialty = new Specialty("Stuff");

            newSpecialty.Create();
            Stylist newStylist = new Stylist("Baxx");

            newStylist.Create();
            List <Stylist> expectedStylists = new List <Stylist> {
                newStylist
            };

            newSpecialty.AddStylist(newStylist);

            //Act
            List <Stylist> Stylists = newSpecialty.GetStylists();

            //AssertAssert
            CollectionAssert.AreEqual(expectedStylists, Stylists);
        }
Example #22
0
        public void GetStylists_ReturnAllClientStylists_StylistsList()
        {
            Client testClient = new Client("Huy", "71273319");

            testClient.Create();

            Stylist testStylist1 = new Stylist("Guy 1");

            testStylist1.Create();
            Stylist testStylist2 = new Stylist("Guy2");

            testStylist2.Create();

            testClient.AddStylist(testStylist1);
            testClient.AddStylist(testStylist2);
            List <Stylist> result   = testClient.GetStylists();
            List <Stylist> testList = new List <Stylist> {
                testStylist1, testStylist2
            };

            CollectionAssert.AreEqual(testList, result);
        }
Example #23
0
        public void SpecialtyADDGET_AddSpecialtyAndReturnThem_True()
        {
            Specialty.ClearAll();
            Stylist.ClearAll();
            Client.ClearAll();
            Stylist newStylist = new Stylist("Joes", 30, Convert.ToDateTime("2018-02-02"));

            newStylist.Create();
            Specialty newSpecialty1 = new Specialty("Mens");

            newSpecialty1.Create();
            Specialty newSpecialty2 = new Specialty("Womens");

            newSpecialty2.Create();

            Console.WriteLine(Specialty.GetAll().Count);

            Console.WriteLine("stylistid " + newStylist.Id);
            newStylist.AddSpecialty(newSpecialty1.Id);
            Console.WriteLine(newSpecialty1.Id + newSpecialty1.Description + newStylist.Id);
            newStylist.AddSpecialty(newSpecialty2.Id);
            Console.WriteLine(newSpecialty2.Id + newSpecialty2.Description + newStylist.Id);

            List <Specialty> testList = new List <Specialty> {
            };

            testList.Add(newSpecialty1);
            testList.Add(newSpecialty2);


            List <Specialty> resultList = newStylist.GetSpecialties();

            Assert.AreEqual(testList[0].Id, resultList[0].Id);
            Assert.AreEqual(testList[0].Description, resultList[0].Description);
            Assert.AreEqual(testList[1].Id, resultList[1].Id);
            Assert.AreEqual(testList[1].Description, resultList[1].Description);
        }