Пример #1
0
        public void TestDeleteEmployee()
        {
            int empid = 4;
            AddEmployeeTransaction t = new AddCommissionedEmployee(empid, "Bill", "Home", 1000.00, 50.00);
            t.Execute();

            Employee e = PayrollDatabase.GetEmployee(empid);
            Assert.AreEqual(e.Name, "Bill");

            DeleteEmployeeTransaction dt = new DeleteEmployeeTransaction(empid);
            dt.Execute();

            e = PayrollDatabase.GetEmployee(empid);
            Assert.IsNull(e);
        }
Пример #2
0
        public void TestAddCommissionedEmployee()
        {
            int empid = 1;
            AddEmployeeTransaction t = new AddCommissionedEmployee(empid, "Bob", "Home", 1000.00,50.00);
            t.Execute();

            Employee e = PayrollDatabase.GetEmployee(empid);
            Assert.AreEqual(e.Name, "Bob");

            IPaymentClassification pc = e.Classification;
            Assert.IsTrue(pc is SalariedClassification);
            SalariedClassification sc = pc as SalariedClassification;

            Assert.AreEqual(1000.00, sc.Salary, .001);
            IPaymentSchedule ps = e.Schedule;
            Assert.IsTrue(ps is MonthlySchedule);

            IPayemntMethod pm = e.Method;
            Assert.IsTrue(pm is HoldMethod);

        }
Пример #3
0
        public void TestChangeHourlyTransaction()
        {
            int empId = 3;
            AddCommissionedEmployee employee=new AddCommissionedEmployee(empId,"Lance","Home",2500,3.2);
            employee.Execute();

           ChangeHourlyTransaction cht=new ChangeHourlyTransaction(empId,27.52);
            cht.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);
           Assert.IsNotNull(e);

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

            Assert.IsTrue(pc is HourlyClassification);
            HourlyClassification hc=pc as HourlyClassification;
            Assert.AreEqual(27.52,hc.Salary,0.001);

            IPaymentSchedule ps = e.Schedule;
            Assert.IsTrue(ps is WeeklySchedule);
        }