Example #1
0
        public void AddManager_InvalidSubordinatePositionName_ShouldThrowPositionAlreadyExistsException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            Assert.ThrowsException <PositionAlreadyExistsException>(() => cm.AddManager("M1", "Head"));
        }
Example #2
0
        public void AddManager_InvalidSupervisorPositionName_ShouldThrowPositionDoesNotExistException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            Assert.ThrowsException <PositionDoesNotExistException>(() => cm.AddManager("M1", "M2"));
        }
Example #3
0
        public void AddManager_ValidData_AddsManagerPosition()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
        }
Example #4
0
        public void Hire_InvalidPositionName_ShouldThrowPositionDoesNotExistException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            Assert.ThrowsException <PositionDoesNotExistException>(() => cm.Hire("Tom", "3200", "W1"));
        }
Example #5
0
        public void Hire_InvalidSalary_ShouldThrowArgumentOutOfRangeException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            Assert.ThrowsException <ArgumentOutOfRangeException>(() => cm.Hire("Tom", "-3200", "M1"));
        }
Example #6
0
        public void Hire_InvalidName_ShouldThrowFormatException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            Assert.ThrowsException <FormatException>(() => cm.Hire(".Tom", "3200", "M1"));
        }
Example #7
0
        public void Hire_ValidData_AddsEmployee()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            cm.Hire("Tom", "3200", "M1");
        }
Example #8
0
        public void AddManager_InvalidSupervisorPositionType_ShouldThrowPositionCanNotHaveSubordinatesException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddWorker("W1", "Head");
            Assert.ThrowsException <PositionCanNotHaveSubordinatesException>(() => cm.AddManager("M1", "W1"));
        }
Example #9
0
        public void ChangeHead_ExistedPositionName_ShouldThrowPositionAlreadyExistsException()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("SecondHead", "Head");
            Assert.ThrowsException <PositionAlreadyExistsException>(() => cm.ChangeHead("SecondHead"));
        }
Example #10
0
        public void Appoint_ValidData_ChangesEmployeesPosition()
        {
            CompanyManager cm = new CompanyManager(new Company("Test"));

            cm.NewHead("Head");
            cm.AddManager("M1", "Head");
            cm.AddWorker("W1", "M1");
            cm.Hire("Tom", "3200", "W1");
            cm.Appoint("0", "M1");
        }