Пример #1
0
        public async Task DeleteEmployee()
        {
            int empId = 2;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bill", "Home", 2500, 3.2);
            await t.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);

            DeleteEmployeeTransaction dt = new DeleteEmployeeTransaction(empId);
            await dt.ExecuteAsync();

            e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.Null(e);
        }
Пример #2
0
        public async Task ChangeSalariedTransaction()
        {
            int empId = 7;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 3.2);
            await t.ExecuteAsync();

            ChangeSalariedTransaction cht = new ChangeSalariedTransaction(empId, 2500);
            await cht.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);
            Classification.PaymentClassification pc = e.Classification;
            Assert.NotNull(pc);
            Assert.True(pc is Payroll.Classification.SalariedClassification);
            Payroll.Classification.SalariedClassification sc = pc as Payroll.Classification.SalariedClassification;
            Assert.Equal(2500, sc.Salary);
            IPaymentSchedule ps = e.Schedule;

            Assert.True(ps is BiWeeklySchedule);
        }
Пример #3
0
        public async Task ChangeHourlyTransaction()
        {
            int empId = 6;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 3.2);
            await t.ExecuteAsync();

            ChangeHourlyTransaction cht = new ChangeHourlyTransaction(empId, 27.52);
            await cht.ExecuteAsync();

            Employee e = await PayrollDatabase.GetEmployeeAsync(empId);

            Assert.NotNull(e);
            Classification.PaymentClassification pc = e.Classification;
            Assert.NotNull(pc);
            Assert.True(pc is HourlyClassification);
            HourlyClassification hc = pc as HourlyClassification;

            Assert.Equal(27.52, hc.HourlyRate);
            IPaymentSchedule ps = e.Schedule;

            Assert.True(ps is WeeklySchedule);
        }