Exemplo n.º 1
0
        public void TestSalesReceiptTransaction()
        {
            int empId = 6;
            AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 2000, 3.0, database);

            t.Execute();

            var saleDay = new DateTime(2017, 3, 19);
            SalesReceiptTransaction srt = new SalesReceiptTransaction(saleDay, 4, empId, database);

            srt.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is CommissionedClassification);

            CommissionedClassification hc = pc as CommissionedClassification;
            var salesReceipts             = database.GetSalesReceipts(empId).ToList();
            var sr = salesReceipts.FirstOrDefault(x => x.Date == saleDay);

            Assert.IsNotNull(sr);
            Assert.AreEqual(4, sr.Amount);
        }