Esempio n. 1
0
        public void ChangeDirectMethodTest()
        {
            AddHourlyEmployee he = new AddHourlyEmployee(base.EmpId, base.Name, base.Address, base.HourlyRate);

            he.Execute();
            ChangeDirectTransaction cdt = new ChangeDirectTransaction(base.EmpId);

            cdt.Execute();
            var e = PayrollDatabase.GetEmployee(base.EmpId);

            Assert.IsTrue(e.Method is DirectMethod);
        }
Esempio n. 2
0
        public void ChangeDirectMethod()
        {
            int empid           = 14;
            AddHourlyEmployee t = new AddHourlyEmployee(empid, "Bob", "Home", 313);

            t.Execute();
            ChangeDirectTransaction cdt = new ChangeDirectTransaction(empid, "sberbank", "123456789");

            cdt.Execute();
            Employee e = PayrollDatabase.GetEmployee_Static(empid);

            Assert.IsNotNull(e);
            Assert.AreEqual("Direct sberbank 123456789", e.Method.ToString());
        }
Esempio n. 3
0
        public void ChangeDirectTransaction()
        {
            int empId   = SetupSalariedEmployee();
            var bank    = new Bank();
            var account = new Account();

            var cdt = new ChangeDirectTransaction(empId, bank, account);

            cdt.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.NotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsType <DirectMethod>(pm);
        }
        public void TestChangeDirectTransaction()
        {
            int empId             = 1;
            AddSalariedEmployee t = new AddSalariedEmployee(empId, "Bob", "Home", 1000.00);

            t.Execute();

            ChangeDirectTransaction cht = new ChangeDirectTransaction(empId, "bank123", "account123");

            cht.Execute();

            Employee e = PayrollDatabase.GetEmployee(empId);

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

            PaymentMethod pm = e.Method;

            Assert.IsTrue(pm is DirectMethod);
        }
Esempio n. 5
0
        public void TestChangeDirectTransaction()
        {
            int empId = 2;
            AddCommissionEmployee t = new AddCommissionEmployee(empId, "Kubing", "Home", 2000.00, 3.1, database);

            t.Execute();

            ChangeDirectTransaction cdt = new ChangeDirectTransaction(empId, database);

            cdt.Execute();

            Employee e = database.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is DirectDepositMethod);
        }
Esempio n. 6
0
        public void ChangeDirectMethod()
        {
            int empId             = 6;
            AddSalariedEmployee t =
                new AddSalariedEmployee(
                    empId, "Mike", "Home", 3500.00, database);

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

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

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

            Assert.IsNotNull(method);
            Assert.IsTrue(method is DirectDepositMethod);
        }
Esempio n. 7
0
        public void TestChangeDirectTransaction()
        {
            const int empId = 13;
            var       t     = new AddSalariedEmployee(empId, "Bill", "Home", 2500.00);

            t.Execute();
            var cdt = new ChangeDirectTransaction(empId, "Bank", "Account");

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

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

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is DirectMethod);
            var dm = pm as DirectMethod;

            Assert.AreEqual("Bank", dm.Bank);
            Assert.AreEqual("Account", dm.Account);
        }
Esempio n. 8
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);
        }
Esempio n. 9
0
        public void TestChangeDirectTransaction()
        {
            int empId           = 2;
            AddHourlyEmployee t = new AddHourlyEmployee(empId, "Bill", "Home", 15.25);

            t.Execute();

            ChangeDirectTransaction mt = new ChangeDirectTransaction(empId, "b_test", "a_test");

            mt.Execute();
            Employee e = PayrollDatabase.GetEmployee(empId);

            Assert.IsNotNull(e);

            PaymentMethod pm = e.Method;

            Assert.IsNotNull(pm);
            Assert.IsTrue(pm is DirectMethod);
            DirectMethod dm = pm as DirectMethod;

            Assert.AreEqual("b_test", dm.Bank);
            Assert.AreEqual("a_test", dm.Account);
        }
Esempio n. 10
0
        public void TestChangeDirectTransaction()
        {
            var empId = 1;
            var addTx = new AddSalariedEmployee(empId, "Lance", "Home", 2500);

            addTx.Execute();

            var changeDirectTx = new ChangeDirectTransaction(empId, "Citigroup", "12345678");

            changeDirectTx.Execute();

            var employee = Database.GetEmployee(empId);

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

            var method = employee.GetMethod();

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

            var directMethod = (DirectMethod)method;

            Assert.AreEqual("Citigroup", directMethod.Bank);
            Assert.AreEqual("12345678", directMethod.Account);
        }