public void CanCreateSalaryEmployee()
        {
            IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                YearlyRate = 120000,
                Type       = EmployeeType.Salary
            };
            var employee = basicEmployeeFactory.CreateEmployee(contract);

            Assert.IsTrue(employee.Type == EmployeeType.Salary);
        }
        public void EmployeesDoHaveDepartment()
        {
            IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                HourlyRate          = 10,
                WeeklyHourAllotment = 40,
                Type = EmployeeType.Hourly
            };
            var employee = basicEmployeeFactory.CreateEmployee(contract);

            Assert.IsNotNull(employee.Department);
        }
        public void CanCreateContractEmployee()
        {
            IEmployeeFactory basicEmployeeFactory = new DepartmentEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                HourlyRate          = 10,
                WeeklyHourAllotment = 40,
                Type = EmployeeType.Contract
            };
            var employee = basicEmployeeFactory.CreateEmployee(contract);

            Assert.IsTrue(employee.Type == EmployeeType.Contract);
        }
示例#4
0
        public void CanGetSalaryMonthlyPaycheck()
        {
            IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory();

            var contract = new EmployeeBuilderContract()
            {
                YearlyRate = 120000,
                Type       = EmployeeType.Salary
            };

            IEmployee employee = basicEmployeeFactory.CreateEmployee(contract);

            Assert.IsTrue(employee.GetMonthlyPaycheck() == 120000m / 12);
        }
示例#5
0
        public void CanGetContractMonthlyPaycheck()
        {
            IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                HourlyRate          = 10,
                WeeklyHourAllotment = 40,
                Type = EmployeeType.Contract
            };

            IEmployee employee = basicEmployeeFactory.CreateEmployee(contract);

            Assert.IsTrue(employee.GetMonthlyPaycheck() == 10 * 40 * 4);
        }
示例#6
0
        public void CanOverrideFullName()
        {
            IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                YearlyRate = 120000,
                Type       = EmployeeType.Salary
            };
            IEmployee employee = basicEmployeeFactory.CreateEmployee(contract);

            employee.FirstName = "John";
            employee.LastName  = "Smith";

            Assert.IsTrue(employee.GetFullName().Equals("Smith, John", StringComparison.InvariantCultureIgnoreCase));
        }
示例#7
0
        public void DefaultFullNameWorks()
        {
            IEmployeeFactory basicEmployeeFactory = new BasicEmployeeFactory();
            var contract = new EmployeeBuilderContract()
            {
                HourlyRate          = 10,
                WeeklyHourAllotment = 40,
                Type = EmployeeType.Hourly
            };
            IEmployee employee = basicEmployeeFactory.CreateEmployee(contract);

            employee.FirstName = "John";
            employee.LastName  = "Smith";

            Assert.IsTrue(employee.GetFullName().Equals("John Smith", StringComparison.InvariantCultureIgnoreCase));
        }