コード例 #1
0
        public void Delete_DeleteStylistFromDatabaseAndStylist_SpecialtyTable_Stylist()
        {
            // Arrange
            Stylist testStylist = new Stylist("testName", "testDescription", 1);

            testStylist.Save();
            Specialties testSpecialty = new Specialties("testSpecialty");

            testSpecialty.Save();
            StylistSpecialties testStylistSpecialty = new StylistSpecialties(testStylist.GetId(), testSpecialty.GetId());

            testStylistSpecialty.Save();

            // Act
            testStylist.Delete();

            // Assert
            Assert.AreEqual(0, Stylist.FindById(testStylist.GetId()).GetId());
            Assert.AreEqual(0, testSpecialty.GetStylists().Count);
        }
コード例 #2
0
        public void GetStylists_RetrievesAllStylistsWithSpecialtyId_StylistList()
        {
            // Arrange
            Specialties testSpecialty = new Specialties("testSpecialty");

            testSpecialty.Save();
            Stylist testStylist = new Stylist("testStylist");

            testStylist.Save();
            StylistSpecialties testStylistSpecialty = new StylistSpecialties(testStylist.GetId(), testSpecialty.GetId());

            testStylistSpecialty.Save();
            List <Stylist> testStylists = new List <Stylist> {
                testStylist
            };

            // Act
            List <Stylist> resultStylists = testSpecialty.GetStylists();

            // Assert
            CollectionAssert.AreEqual(testStylists, resultStylists);
        }