Ejemplo n.º 1
0
        public void TestChangeCommisionTransaction()
        {
            int empId             = 5;
            AddSalariedEmployee t =
                new AddSalariedEmployee(
                    empId, "Bob", "Home", 2500.00, database);

            t.Execute();
            ChangeCommissionedTransaction cht =
                new ChangeCommissionedTransaction(empId, 1250.00, 5.6, database);

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

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

            Assert.IsNotNull(pc);
            Assert.IsTrue(pc is CommissionClassification);
            CommissionClassification cc = pc as CommissionClassification;

            Assert.AreEqual(1250.00, cc.BaseRate, .001);
            Assert.AreEqual(5.6, cc.CommissionRate, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is BiWeeklySchedule);
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int             id               = int.Parse(textid.Text);
            double          baseRate         = double.Parse(textbaseRate.Text);
            double          commissionRate   = double.Parse(textcommissionRate.Text);
            PayrollDatabase pd               = new sytpayrolldatabase();
            ChangeCommissionedTransaction pt = new ChangeCommissionedTransaction(id, baseRate, commissionRate, pd);

            pt.Execute();
        }