Пример #1
0
        public void ChangeHoldTransaction()
        {
            int empId = SetupSalariedEmployee();

            var cht = new ChangeHoldTransaction(empId);

            cht.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsType <HoldMethod>(pm);
        }
Пример #2
0
        public void TestChangeHoldTransaction()
        {
            int empId = 4;
            AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 2000.00, 3.1, database);

            t.Execute();

            ChangeHoldTransaction cmt = new ChangeHoldTransaction(empId, database);

            cmt.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is HoldMethod);
        }
Пример #3
0
        public void TestChangeHoldTransaction()
        {
            const int empId = 15;
            var       t     = new AddSalariedEmployee(empId, "Bill", "Home", 2500.00);

            t.Execute();
            var cmt = new ChangeMailTransaction(empId, "Work");

            cmt.Execute();
            var cht = new ChangeHoldTransaction(empId);

            cht.Execute();
            var e = PayrollDatabase.GetEmployee(empId);

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

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is HoldMethod);
        }
Пример #4
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);
        }
        public void TestChangeHoldTransaction()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00);

            t.Execute();

            ITransaction cht = new ChangeMailTransaction(empId, "address123");

            cht.Execute();

            cht = new ChangeHoldTransaction(empId);
            cht.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

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

            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is HoldMethod);
        }
Пример #6
0
        public void ExecuteTest()
        {
            int    empId   = 29;
            string bank    = "MisBank";
            string account = "3329";

            AddEmployeeTransaction addSalEmp = new AddSalariedEmployee(empId, "kara", "samubola", 3000, database);

            addSalEmp.Execute();

            ChangeMethodTranscation changeDirectTrans = new ChangeDirectTransaction(empId, bank, account, database);

            changeDirectTrans.Execute();
            ChangeMethodTranscation changeHoldTrans = new ChangeHoldTransaction(empId, database);

            changeHoldTrans.Execute();

            Employee emp = database.GetEmployee(empId);

            Assert.IsNotNull(emp);
            Assert.IsTrue(emp.Method is HoldMethod);
        }
Пример #7
0
        public void TestChangeHoldTransaction()
        {
            var empId = 1;
            var addTx = new AddSalariedEmployee(empId, "Lance", "Home", 2500);

            addTx.Execute();

            var changeMailTx = new ChangeMailTransaction(empId, "Home");

            changeMailTx.Execute();

            var changeHoldTx = new ChangeHoldTransaction(empId);

            changeHoldTx.Execute();

            var employee = Database.GetEmployee(empId);

            Assert.IsNotNull(employee, "employee not found in database");

            var method = employee.GetMethod();

            Assert.IsInstanceOfType(method, typeof(HoldMethod), "employee does not have correct payment method");
        }