示例#1
0
        public void TestChangeHourlyTransaction()
        {
            int empId = 3;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bob", "Home", 2500m, 3.4m);

            t.Execute();

            ChangeClassificationTransaction cht = new ChangeHourlyTransaction(empId, 27.52m);

            cht.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e, Is.Not.Null);
            PaymentClassification pc = e.Classification;

            Assert.That(pc, Is.Not.Null);
            Assert.That(pc is HourlyClassification, Is.True);
            HourlyClassification hc = pc as HourlyClassification;

            Assert.That(hc.HourlyRate, Is.EqualTo(27.52m));
            PaymentSchedule ps = e.Schedule;

            Assert.That(ps is WeeklySchedule);
        }
示例#2
0
        public void TestAddHourlyEmployee()
        {
            int empId = 2;
            AddEmployeeTransaction t = new AddHourlyEmployee(empId, "Bob", "Home", 12.75m);

            t.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e.Name, Is.EqualTo("Bob"));

            PaymentClassification pc = e.Classification;

            Assert.That(pc is HourlyClassification, Is.True);
            HourlyClassification hc = pc as HourlyClassification;

            Assert.That(hc.HourlyRate, Is.EqualTo(12.75m));
            PaymentSchedule ps = e.Schedule;

            Assert.That(ps is WeeklySchedule, Is.True);

            PaymentMethod pm = e.Method;

            Assert.That(pm is HoldMethod, Is.True);
        }
示例#3
0
        public void TestTimeCardTransaction()
        {
            int empId           = 5;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25m);

            t.Execute();

            TimeCardTransaction tct = new TimeCardTransaction(new DateTime(2020, 02, 02), 8.0, empId);

            tct.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.That(e, Is.Not.Null);

            PaymentClassification pc = e.Classification;

            Assert.That(pc is HourlyClassification, Is.True);
            HourlyClassification hc = pc as HourlyClassification;
            TimeCard             tc = hc.GetTimeCard(new DateTime(2020, 02, 02));

            Assert.That(tc, Is.Not.Null);
            Assert.That(tc.Hours, Is.EqualTo(8.0));
        }