Exemplo n.º 1
0
        public void TestPaySingleCommissionedEmployeeTwoPeriods()
        {
            int empId = 3;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bob", "Home", 1000m, 0.5m);

            t.Execute();
            DateTime payDate            = new DateTime(2020, 02, 21);
            SalesReceiptTransaction srt = new SalesReceiptTransaction(payDate, 100m, empId);

            srt.Execute();
            SalesReceiptTransaction srt2 = new SalesReceiptTransaction(payDate.AddDays(-13), 100m, empId);

            srt2.Execute();

            PaydayTransaction pt = new PaydayTransaction(payDate);

            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 1000m + 0.5m * 200m);


            payDate = new DateTime(2020, 03, 06);
            pt      = new PaydayTransaction(payDate);
            pt.Execute();

            ValidatePaycheck(pt, empId, payDate, 1000m);
        }
Exemplo n.º 2
0
        public void TestSalesReceiptTransaction()
        {
            int empId = 6;
            AddCommissionedEmployee t = new AddCommissionedEmployee(empId, "Bill", "Home", 2500m, 3.5m);

            t.Execute();

            SalesReceiptTransaction srt = new SalesReceiptTransaction(new DateTime(2020, 02, 02), 500000m, empId);

            srt.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

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

            PaymentClassification pc = e.Classification;

            Assert.That(pc is CommissionedClassification, Is.True);
            CommissionedClassification cc = pc as CommissionedClassification;

            SalesReceipt sr = cc.GetSalesReceipt(new DateTime(2020, 02, 02));

            Assert.That(sr, Is.Not.Null);
            Assert.That(sr.Amount, Is.EqualTo(500000m));
        }