Beispiel #1
0
        public void Test_Find_FindsStylistsInDatabase()
        {
            //Arrange
            Stylists testStylists = new Stylists("Jacob");

            testStylists.Save();
            //Act
            Stylists foundStylists = Stylists.Find(testStylists.GetId());

            //Assert
            Assert.Equal(testStylists, foundStylists);
        }
Beispiel #2
0
        public void Test_GetClients_RetrieveAllClientsWithinStylists()
        {
            //Arrange
            Stylists testStylists = new Stylists("Jacob");

            testStylists.Save();

            Clients firstClients = new Clients("Susan", testStylists.GetId());

            firstClients.Save();
            Clients secondClients = new Clients("Emma", testStylists.GetId());

            secondClients.Save();

            //Act
            List <Clients> testClientsList = new List <Clients> {
                firstClients, secondClients
            };
            List <Clients> resultClientsList = testStylists.GetClients();

            //Assert
            Assert.Equal(testClientsList, resultClientsList);
        }
Beispiel #3
0
 public override bool Equals(System.Object otherStylists)
 {
     if (!(otherStylists is Stylists))
     {
         return(false);
     }
     else
     {
         Stylists newStylists  = (Stylists)otherStylists;
         bool     idEquality   = (this.GetId() == newStylists.GetId());
         bool     nameEquality = (this.GetName() == newStylists.GetName());
         return(idEquality && nameEquality);
     }
 }
Beispiel #4
0
        public void Test_Delete_DeleteStylistFromDatabase()
        {
            //Arrange
            string   name1        = "Gary";
            Stylists testStylist1 = new Stylists(name1);

            testStylist1.Save();

            string   name2        = "Wallace";
            Stylists testStylist2 = new Stylists(name2);

            testStylist2.Save();

            Clients client1 = new Clients("Susan", testStylist1.GetId());

            client1.Save();
            Clients client2 = new Clients("Emma", testStylist2.GetId());

            client2.Save();

            //Act
            testStylist1.Delete();
            List <Stylists> resultStylists = Stylists.GetAll();
            List <Stylists> testStylists   = new List <Stylists> {
                testStylist2
            };

            List <Clients> resultClients = Clients.GetAll();
            List <Clients> clientsList   = new List <Clients> {
                client2
            };

            //Assert
            Assert.Equal(testStylists, resultStylists);
            Assert.Equal(clientsList, resultClients);
        }