예제 #1
0
        public void TestChangeSalariedTransaction()
        {
            int empId = 4;
            AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 2500, 3.2, database);

            t.Execute();

            ChangeSalariedTransaction cst = new ChangeSalariedTransaction(empId, 1000.00, database);

            cst.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is SalariedClassification);

            SalariedClassification sc = pc as SalariedClassification;

            Assert.AreEqual(1000.00, sc.Salary, 0.001);

            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);
        }
        public void TestChangeSalariedTransaction()
        {
            int empId = 3;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 10);

            t.Execute();

            ChangeSalariedTransaction cht = new ChangeSalariedTransaction(empId, 3000);

            cht.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is SalariedClassification);

            SalariedClassification hc = pc as SalariedClassification;

            Assert.AreEqual(3000, hc.Salary, .001);

            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);
        }
예제 #3
0
        public void TestChangeSalariedTransaction()
        {
            var empId = 1;
            var addTx = new AddCommissionedEmployee(empId, "Lance", "Home", 2500, 3.2M);

            addTx.Execute();

            var changeSalariedTx = new ChangeSalariedTransaction(empId, 2000M);

            changeSalariedTx.Execute();

            var employee = Database.GetEmployee(empId);

            Assert.IsNotNull(employee, "employee not found in database");

            var classification = employee.GetClassification();

            Assert.IsInstanceOfType(classification, typeof(SalariedClassification), "employee does not have salaried classification");

            var salariedClassification = (SalariedClassification)classification;

            Assert.AreEqual(2000M, salariedClassification.Salary);

            var schedule = employee.GetSchedule();

            Assert.IsInstanceOfType(schedule, typeof(MonthlySchedule), "schedule is not monthly");
        }
예제 #4
0
        public void ChangeHourlyEmployeeIntoSalariedEmployeeTest()
        {
            AddHourlyEmployee he = new AddHourlyEmployee(base.EmpId, base.Name, base.Address, base.HourlyRate);

            he.Execute();
            ChangeSalariedTransaction cst = new ChangeSalariedTransaction(base.EmpId, base.Salary);

            cst.Execute();
            var e = PayrollDatabase.GetEmployee(base.EmpId);

            Assert.IsTrue(e.Classification is SalariedClassification);
            Assert.IsTrue(e.Schedule is MonthlySchedule);
        }
        public void ExecuteTest()
        {
            int    empId  = 23;
            double salary = 1600;

            AddEmployeeTransaction addHourlyEmp = new AddHourlyEmployee(empId, "kara", "samubola", 3000, database);

            addHourlyEmp.Execute();

            ChangeClassificationTranscation changeHourlyTrans = new ChangeSalariedTransaction(empId, salary, database);

            changeHourlyTrans.Execute();
            Employee emp = database.GetEmployee(empId);

            Assert.IsNotNull(emp);
            Assert.IsTrue(emp.Classification is SalariedClassification);

            SalariedClassification hc = emp.Classification as SalariedClassification;

            Assert.IsNotNull(hc);
            Assert.AreEqual(hc.Salary, salary);
        }
예제 #6
0
        public void ChangeSalariedTransaction()
        {
            int empId = SetupCommissionedEmployee();

            var cst = new ChangeSalariedTransaction(empId, 2500.0);

            cst.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.NotNull(e);
            var sc = Assert.IsType <SalariedClassification>(pc);

            Assert.Equal(2500.0, sc.Salary);

            PaymentSchedule ps = e.Schedule;

            Assert.IsType <MonthlySchedule>(ps);
        }
예제 #7
0
        public void ChangeSalariedTransaction()
        {
            int empid           = 12;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 23.41);

            t.Execute();
            ChangeSalariedTransaction cht = new ChangeSalariedTransaction(empid, 20.44);

            cht.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

            Assert.IsNotNull(e);
            PaymentClassification pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is SalariedClassification);
            SalariedClassification sc = pc as SalariedClassification;

            Assert.AreEqual(20.44, sc.Salary);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);
        }
예제 #8
0
        public void TestChangeSalariedTransaction()
        {
            const int empId = 11;
            var       t     = new AddHourlyEmployee(empId, "Lance", "Home", 27.52);

            t.Execute();
            var cst = new ChangeSalariedTransaction(empId, 2500.00);

            cst.Execute();
            var e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);
            var pc = e.Classification;

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is SalariedClassification);
            var sc = pc as SalariedClassification;

            Assert.AreEqual(2500.00, sc.Salary, 0.001);
            var ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);
        }