Exemplo n.º 1
0
        public void TestPayCommissionedEmployeeTwoSalesReceipts()
        {
            const int empId = 30;
            var       t     = new AddCommissionedEmployee(empId, "Bob", "Home", 2500.00, 3.2);

            t.Execute();
            var payDate = new DateTime(2020, 7, 17);
            var srt     = new SalesReceiptTransaction(payDate, 100.0, empId);

            srt.Execute();
            var srt2 = new SalesReceiptTransaction(payDate.AddDays(-1), 200.0, empId);

            srt2.Execute();
            var pt = new PaydayTransaction(payDate);

            pt.Execute();

            var pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual((100.0 + 200) * 3.2, pc.GrossPay, 0.001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, 0.001);
            Assert.AreEqual((100.0 + 200) * 3.2, pc.NetPay, 0.001);
        }
Exemplo n.º 2
0
        public void TestSalesReceiptTransaction()
        {
            const int empId = 6;
            var       t     = new AddCommissionedEmployee(empId, "Bill", "Home", 2500.00, 3.2);

            t.Execute();
            var srt = new SalesReceiptTransaction(new DateTime(2020, 7, 31), 100.00, empId);

            srt.Execute();

            var e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            var pc = e.Classification;

            Assert.IsTrue(pc is CommissionedClassification);
            var cc = pc as CommissionedClassification;

            var sc = cc.GetSalesReceipt(new DateTime(2020, 7, 31));

            Assert.IsNotNull(sc);
            Assert.AreEqual(100.00, sc.Amount, 0.001);
        }