public void GetId_ReturnsId_Id()
        {
            Speciality newSpeciality = new Speciality("Hairmaster", 1);
            int        result        = 1;

            Assert.AreEqual(result, newSpeciality.GetId());
        }
예제 #2
0
        public void Find_ReturnsSpecialityInDatabase_Speciality()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            Speciality foundSpeciality = Speciality.Find(testSpeciality.GetId());

            Assert.AreEqual(testSpeciality, foundSpeciality);
        }
예제 #3
0
        public void Save_DatabaseAssignsIdToStylist_Id()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            Speciality savedSpeciality = Speciality.GetAll()[0];
            int        result          = savedSpeciality.GetId();
            int        testId          = testSpeciality.GetId();

            Assert.AreEqual(testId, result);
        }
예제 #4
0
        public void Edit_UpdatesSpecialityNameInDatabase_String()
        {
            Speciality testSpeciality = new Speciality("Cut");

            testSpeciality.Save();
            string secondName = "Color";

            testSpeciality.Edit(secondName);
            string result = Speciality.Find(testSpeciality.GetId()).GetName();

            Assert.AreEqual(secondName, result);
        }
예제 #5
0
        public void Find_Save_GetID_Speciality()
        {
            //Arrange
            Speciality testSpeciality = new Speciality("test1");

            testSpeciality.Save();
            //Act
            Speciality foundSpeciality = Speciality.Find(testSpeciality.GetId());


            Assert.AreEqual(testSpeciality, foundSpeciality);
        }
        public void Find_FindSpeciality_FoundSpeciality()
        {
            //Arrange
            Speciality speciality1 = new Speciality("Cut");

            speciality1.Save();

            //Act
            Speciality foundSpeciality = Speciality.Find(speciality1.GetId()); //why just 0 doens't work?

            //Assert
            Assert.AreEqual(speciality1, foundSpeciality);
        }
예제 #7
0
        public void Find_FindMatchingSpeciality_True()
        {
            //Arrange
            Speciality specialityOne = new Speciality("Cutting");

            specialityOne.Save();
            int id = specialityOne.GetId();

            //Act
            Speciality foundSpeciality = Speciality.Find(id);

            //Assert
            Assert.AreEqual(specialityOne, foundSpeciality);
        }
예제 #8
0
        public void Edit_EditedSpecialityHasDifferentValue_True()
        {
            //Arrange
            Speciality specialityOne = new Speciality("Cutting");
            Speciality specialityTwo = new Speciality("Braiding");

            specialityOne.Save();
            int id = specialityOne.GetId();

            //Act
            specialityOne.Edit("Braiding");
            Speciality foundSpeciality = Speciality.Find(id);

            //Assert
            Assert.AreEqual(specialityTwo, foundSpeciality);
        }
예제 #9
0
        public void Delete_SpecialityDeletedFromDB_True()
        {
            //Arrange
            Speciality specialityOne = new Speciality("Cutting");

            specialityOne.Save();
            int        id = specialityOne.GetId();
            Speciality defaultSpeciality = new Speciality("", 0);

            //Act
            Speciality.Delete(id);
            Speciality notFound = Speciality.Find(id);

            //Assert
            Assert.AreEqual(notFound, defaultSpeciality);
        }
예제 #10
0
        public void Edit_UpdatesSpecialityInDatabase_String()
        {
            string     firstName = "Tests";
            Speciality testName  = new Speciality(firstName, 1);

            testName.Save();
            string testSecondName = "Are fun";

            //Act
            testName.UpdateDescription(testSecondName);

            string result = Speciality.Find(testName.GetId()).GetDescription();

            //Assert
            Assert.AreEqual(testSecondName, result);
        }