public void LoadHoldMethod()
        {
            operation = new LoadPaymentMethodOperation(employee, "hold", null);
            operation.Execute();
            var method = operation.Method;

            Assert.IsTrue(method is HoldMethod);
        }
        public void LoadMailMethodCommand()
        {
            operation = new LoadPaymentMethodOperation(employee, "mail", null);
            operation.Prepare();
            var command = operation.Command;

            Assert.AreEqual("select * from PaycheckAddress where EmpId = @EmpId", command.CommandText);
            Assert.AreEqual(employee.EmpId, command.Parameters["@EmpId"].Value);
        }
        public void LoadDirectDepositMethodCommand()
        {
            operation = new LoadPaymentMethodOperation(employee, "directdeposit", null);
            operation.Prepare();
            var command = operation.Command;

            Assert.AreEqual("select * from DirectDepositAccount where EmpId = @EmpId", command.CommandText);
            Assert.AreEqual(employee.EmpId, command.Parameters["@EmpId"].Value);
        }
        public void LoadMailMethodCommand()
        {
            operation = new LoadPaymentMethodOperation(employee, "mail", null);
            operation.Prepare();
            SqlCommand command = operation.Command;

            Assert.AreEqual("SELECT * FROM PaycheckAddress " +
                            "WHERE EmpId = @EmpId", command.CommandText);
            Assert.AreEqual(employee.Id, command.Parameters["@EmpId"].Value);
        }
        public void LoadDirectDepositMethodCommand()
        {
            operation = new LoadPaymentMethodOperation(employee, "directdeposit", null);
            operation.Prepare();
            SqlCommand command = operation.Command;

            Assert.AreEqual("SELECT * FROM DirectDepositAccount " +
                            "WHERE EmpId = @EmpId", command.CommandText);
            Assert.AreEqual(employee.Id, command.Parameters["@EmpId"].Value);
        }
        public void LoadMailMethodFromRow()
        {
            operation = new LoadPaymentMethodOperation(employee, "mail", null);
            operation.Prepare();
            var row = DataRowUtil.ShuntRow("Address", "23 Pine Ct");

            operation.InvokeCreateor(row);

            var method = operation.Method;

            Assert.IsTrue(method is MailMethod);

            var mailMethod = method as MailMethod;

            Assert.AreEqual("23 Pine Ct", mailMethod.Address);
        }
        public void CreateMailMethodFromRow()
        {
            operation = new LoadPaymentMethodOperation(employee, "mail", null);
            operation.Prepare();
            DataRow row = LoadEmployeeOperationTest.ShuntRow(
                "Address", "23 Pine Ct");

            operation.CreatePaymentMethod(row);

            PaymentMethod method = operation.Method;

            Assert.IsTrue(method is MailMethod);
            MailMethod mailMethod = method as MailMethod;

            Assert.AreEqual("23 Pine Ct", mailMethod.Address);
        }
        public void CreateDirectDepositMethodFromRow()
        {
            operation = new LoadPaymentMethodOperation(employee, "directdeposit", null);
            operation.Prepare();
            var row = DataRowUtil.ShuntRow("Bank,Account", "1st Bank", "0123456");

            operation.InvokeCreateor(row);

            var method = operation.Method;

            Assert.IsTrue(method is DirectDepositMethod);

            var ddMethod = method as DirectDepositMethod;

            Assert.AreEqual("1st Bank", ddMethod.Bank);
            Assert.AreEqual("0123456", ddMethod.Account);
        }
        public void CreateDirectDepositMethodFromRow()
        {
            operation = new LoadPaymentMethodOperation(employee, "directdeposit", null);
            operation.Prepare();
            DataRow row = LoadEmployeeOperationTest.ShuntRow(
                "Bank,Account", "1st Bank", "0123456");

            operation.CreatePaymentMethod(row);

            PaymentMethod method = operation.Method;

            Assert.IsTrue(method is DirectDepositMethod);
            DirectDepositMethod ddMethod = method as DirectDepositMethod;

            Assert.AreEqual("1st Bank", ddMethod.Bank);
            Assert.AreEqual("0123456", ddMethod.AccountNumber);
        }
 private void AddPaymentMethod(DataRow row)
 {
     string methodCode = row["PaymentMethodType"].ToString();
     LoadPaymentMethodOperation operation = new LoadPaymentMethodOperation(employee, methodCode, connection);
     operation.Execute();
     employee.Method = operation.Method;
 }