コード例 #1
0
ファイル: StylistTest.cs プロジェクト: Rick1970/hairsalon
 public void T5_Find_FindNameInDatabase()
 {
     //arrange
       Stylist testStylist = new Stylist("Jane");
       testStylist.Save();
       //act
       Stylist foundStylist = Stylist.Find(testStylist.GetId());
       //Assert
       Assert.Equal(testStylist, foundStylist);
 }
コード例 #2
0
ファイル: StylistTest.cs プロジェクト: Rick1970/hairsalon
        public void T4_Save_AssignsIdToObject()
        {
            //arrange
              Stylist testStylist = new Stylist("Jane");
              //act
              testStylist.Save();
              Stylist savedStylist = Stylist.GetAll()[0];

              int result = savedStylist.GetId();
              int testId = testStylist.GetId();
              //Assert
              Assert.Equal(testId, result);
        }
コード例 #3
0
ファイル: StylistTest.cs プロジェクト: Rick1970/hairsalon
        public void T6_GetClients_RetrievesAllClientsWithStylist()
        {
            Stylist testStylist = new Stylist("Jane");
              testStylist.Save();

              Client firstClient = new Client("Jill", testStylist.GetId());
              firstClient.Save();
              Client secondClient = new Client("Lisa", testStylist.GetId());
              secondClient.Save();

              List<Client> testClientList = new List<Client> {firstClient, secondClient};
              List<Client> resultClientList = testStylist.GetClients();

              Assert.Equal(testClientList, resultClientList);
        }
コード例 #4
0
ファイル: StylistTest.cs プロジェクト: Rick1970/hairsalon
        public void T8_Delete_DeletesStylistFromDatabase()
        {
            //Arrange
              string name1 = "Mike";
              Stylist testStylist1 = new Stylist(name1);
              testStylist1.Save();

              string name2 = "Lucy";
              Stylist testStylist2 = new Stylist(name2);
              testStylist2.Save();

              Client testClient1 = new Client("Shirley", testStylist1.GetId());
              testClient1.Save();
              Client testClient2 = new Client("Bob", testStylist2.GetId());
              testClient2.Save();

              //Act
              testStylist1.Delete();
              List<Stylist> resultStylist = Stylist.GetAll();
              List<Stylist> testStylistList = new List<Stylist> {testStylist2};

              List<Client> resultClients = Client.GetAll();
              List<Client> testClientList = new List<Client> {testClient2};

              //Assert
              Assert.Equal(testStylistList, resultStylist);
              Assert.Equal(testClientList, resultClients);
        }