Exemplo 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);
        }
Exemplo n.º 2
0
        public void SalariedUnionMemberDues()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(
                empId, "Bob", "Home", 1000.00, database);

            t.Execute();
            int memberId = 7734;
            ChangeMemberTransaction cmt =
                new ChangeMemberTransaction(empId, memberId, 9.42, database);

            cmt.Execute();
            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();
            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(1000.0, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(47.1, pc.Deductions, .001);
            Assert.AreEqual(1000.0 - 47.1, pc.NetPay, .001);
        }
Exemplo n.º 3
0
        public void TestAddSalariedEmployee()
        {
            int empId             = 1;
            AddSalariedEmployee t =
                new AddSalariedEmployee(empId, "Bob", "Home", 1000.00, database);

            t.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.AreEqual("Bob", e.Name);

            PaymentClassification pc = e.Classification;

            Assert.IsTrue(pc is SalariedClassification);
            SalariedClassification sc = pc as SalariedClassification;

            Assert.AreEqual(1000.00, sc.Salary, .001);
            PaymentSchedule ps = e.Schedule;

            Assert.IsTrue(ps is MonthlySchedule);

            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Exemplo n.º 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            int                 id      = int.Parse(textid.Text);
            string              name    = textname.Text;
            string              address = textaddress.Text;
            float               salary  = float.Parse(textsalary.Text);
            PayrollDatabase     pd      = new sytpayrolldatabase();
            AddSalariedEmployee emp     = new AddSalariedEmployee(id, name, address, salary, pd);

            emp.Execute();
        }
Exemplo n.º 5
0
        public void PaySingleSalariedEmployeeOnWrongDate()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(
                empId, "Bob", "Home", 1000.00, database);

            t.Execute();
            DateTime          payDate = new DateTime(2001, 11, 29);
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();
            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNull(pc);
        }
Exemplo n.º 6
0
        public void PaySingleSalariedEmployee()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(
                empId, "Bob", "Home", 1000.00, database);

            t.Execute();
            DateTime          payDate = new DateTime(2001, 11, 30);
            PaydayTransaction pt      = new PaydayTransaction(payDate, database);

            pt.Execute();
            Paycheck pc = pt.GetPaycheck(empId);

            Assert.IsNotNull(pc);
            Assert.AreEqual(payDate, pc.PayDate);
            Assert.AreEqual(1000.00, pc.GrossPay, .001);
            Assert.AreEqual("Hold", pc.GetField("Disposition"));
            Assert.AreEqual(0.0, pc.Deductions, .001);
            Assert.AreEqual(1000.00, pc.NetPay, .001);
        }
Exemplo n.º 7
0
        public void ChangeMailMethod()
        {
            int empId             = 8;
            AddSalariedEmployee t =
                new AddSalariedEmployee(
                    empId, "Mike", "Home", 3500.00, database);

            t.Execute();
            ChangeMailTransaction cmt =
                new ChangeMailTransaction(empId, database);

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

            Assert.IsNotNull(e);
            PaymentMethod method = e.Method;

            Assert.IsNotNull(method);
            Assert.IsTrue(method is MailMethod);
        }
Exemplo n.º 8
0
        public void ChangeDirectMethod()
        {
            var empId = 6;
            var t     =
                new AddSalariedEmployee(
                    empId, "Mike", "Home", 3500.00, database);

            t.Execute();
            var cddt =
                new ChangeDirectTransaction(empId, database);

            cddt.Execute();
            var e = database.GetEmployee(empId);

            Assert.IsNotNull(e);
            var method = e.Method;

            Assert.IsNotNull(method);
            Assert.IsTrue(method is DirectDepositMethod);
        }
Exemplo n.º 9
0
        public void ChangeHoldMethod()
        {
            int empId             = 7;
            AddSalariedEmployee t =
                new AddSalariedEmployee(
                    empId, "Mike", "Home", 3500.00, database);

            t.Execute();
            new ChangeDirectTransaction(empId, database).Execute();
            ChangeHoldTransaction cht =
                new ChangeHoldTransaction(empId, database);

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

            Assert.IsNotNull(e);
            PaymentMethod method = e.Method;

            Assert.IsNotNull(method);
            Assert.IsTrue(method is HoldMethod);
        }