Beispiel #1
0
        static void Main(string[] args)
        {
            ProfileStaffMember profile = new ProfileStaffMember("Потапов.А О", "Отдел-7", "руководитель");

            profile.ChangeDepartment("Отдел-0");
            profile.ChangePosition("инженер");
            profile.ChangeDepartment("Ц0");
            profile.SalaryReceive("kl9", "директор");
        }
        public void ChangePosition_Successful(string position, bool expectedResult)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember(null);

            //Act
            var ex = profile.ChangePosition(position);

            //Assert
            Assert.Equal(expectedResult, ex);
        }
        public void ChangeDepartment_Successful(string department, bool expectedResult)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember(null);

            //Act
            var ex = profile.ChangeDepartment(department);

            //Assert
            Assert.Equal(expectedResult, ex);
        }
        public void UpdatePosition_Successful(string previousPosition, string newPosition, bool expectedResult)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember(null);

            //Act
            var ex = profile.PositionUpgrade(previousPosition, newPosition);

            //Assert
            Assert.Equal(expectedResult, ex);
        }
        public void PositionDemotion_ThrowsException(string previousPosition, string expectedInvalidMessage)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember(null);

            //Act
            var ex = Record.Exception(() => profile.PositionDemotion(previousPosition));

            //Assert
            if (ex is ArgumentException argEx)
            {
                Assert.Equal(argEx.Message, expectedInvalidMessage);
            }
        }
        public void ChangeDepartment_ThrowsException(string department, string expectedInvalidMessage)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember(null);

            //Act
            var ex = Record.Exception(() => profile.ChangeDepartment(department));

            //Assert
            if (ex is ArgumentException argEx)
            {
                Assert.Equal(argEx.Message, expectedInvalidMessage);
            }
        }
        public void CreateProfile_Successful(string fullName, string department, string position)
        {
            //Arrange
            string expectedfullName   = fullName.ToLower();
            string expecteddepartment = department.ToLower();
            string expectedposition   = position.ToLower();

            //Act
            var actual = new ProfileStaffMember(fullName, department, position);

            //Assert
            Assert.Equal(expectedfullName, actual.FullName);
            Assert.Equal(expecteddepartment, actual.Department);
            Assert.Equal(expectedposition, actual.Pos);
        }
        public void SearchPosition_Successful(string _fullName, string _position, bool expectedResult)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember("Потапова А.А", "Отдел-4", "директор");

            profile.ChangePosition("инженер");
            profile.ChangePosition("разнорабочий");
            profile.ChangePosition("руководитель");

            //Act
            var ex = profile.SearchPosition(_fullName, _position);

            //Assert
            Assert.Equal(expectedResult, ex);
        }
        public void SearchDepartment_Successful(string _fullName, string _department, bool expectedResult)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember("Потапова А.А", "Отдел-4", "директор");

            profile.ChangeDepartment("Отдел-3");
            profile.ChangeDepartment("Отдел-9");
            profile.ChangeDepartment("Отдел-5");

            //Act
            var ex = profile.SearchDepartment(_fullName, _department);

            //Assert
            Assert.Equal(expectedResult, ex);
        }
        public void SearchPosition_ThrowsException(string _fullName, string _position, string expectedInvalidMessage)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember("Потапова А.А", "Отдел-4", "директор");

            profile.ChangePosition("инженер");
            profile.ChangePosition("разнорабочий");
            profile.ChangePosition("руководитель");

            //Act
            var ex = Record.Exception(() => profile.SearchPosition(_fullName, _position));

            //Assert
            if (ex is ArgumentException argEx)
            {
                Assert.Equal(argEx.Message, expectedInvalidMessage);
            }
        }
        public void SearchDepartment_ThrowsException(string _fullName, string _department, string expectedInvalidMessage)
        {
            //Arrange
            ProfileStaffMember profile = new ProfileStaffMember("Потапова А.О", "Отдел-4", "директор");

            profile.ChangeDepartment("Отдел-3");
            profile.ChangeDepartment("Отдел-9");
            profile.ChangeDepartment("Отдел-5");

            //Act
            var ex = Record.Exception(() => profile.SearchDepartment(_fullName, _department));

            //Assert
            if (ex is ArgumentException argEx)
            {
                Assert.Equal(argEx.Message, expectedInvalidMessage);
            }
        }