示例#1
0
        public void LoadingHoldMethod()
        {
            var row = DataRowUtil.ShuntRow("PaymentMethodType", "hold");

            operation.AddPaymentMethod(row);

            Assert.IsTrue(employee.Method is HoldMethod);
        }
示例#2
0
        public void LoadEmployeeData()
        {
            var row = DataRowUtil.ShuntRow("Name,Address", "Kubing", "10 Rue de Roi");

            operation.CreateEmployee(row);

            Assert.IsNotNull(operation.Employee);
            Assert.AreEqual("Kubing", operation.Employee.Name);
            Assert.AreEqual("10 Rue de Roi", operation.Employee.Address);
        }
示例#3
0
        public void LoadingSchedules()
        {
            var row = DataRowUtil.ShuntRow("ScheduleType", "weekly");

            operation.AddSchedule(row);
            Assert.IsTrue(employee.Schedule is WeeklySchedule);

            row = DataRowUtil.ShuntRow("ScheduleType", "biweekly");
            operation.AddSchedule(row);
            Assert.IsTrue(employee.Schedule is BiweeklySchedule);

            row = DataRowUtil.ShuntRow("ScheduleType", "monthly");
            operation.AddSchedule(row);
            Assert.IsTrue(employee.Schedule is MonthlySchedule);
        }
        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 LoadSalariedClassificationFromRow()
        {
            operation = new LoadPaymentClassificationOperation(employee, "salaried", null);
            operation.Prepare();
            var row = DataRowUtil.ShuntRow("Salary", 1000.00);

            operation.InvokeCreateor(row);

            var classification = operation.Classification;

            Assert.IsTrue(classification is SalariedClassification);

            var salariedClassification = classification as SalariedClassification;

            Assert.AreEqual(1000.00, salariedClassification.Salary, .01);
        }
        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);
        }
示例#7
0
        public void DataTableToObjectList()
        {
            var row =
                DataRowUtil.ShuntRow("Int,Double,Float,Decimal,String,Char,Bool,DateTime"
                                     , 1, 2.1d, 3.2f, 4.5m, "str", 'c', true, new DateTime(1995, 5, 3));

            var table = row.Table;
            var list  = table.ToList <ObjectClass>();

            Assert.IsTrue(list.Count == 1);

            var obj = list[0];

            Assert.AreEqual(1, obj.Int);
            Assert.AreEqual(2.1d, obj.Double, .01);
            Assert.AreEqual(3.2f, obj.Float);
            Assert.AreEqual(4.5m, obj.Decimal);
            Assert.AreEqual("str", obj.String);
            Assert.AreEqual('c', obj.Char);
            Assert.IsTrue(obj.Bool);
            Assert.AreEqual(new DateTime(1995, 5, 3), obj.DateTime);
        }
示例#8
0
        public void DataTableToNullableObjectList()
        {
            var row =
                DataRowUtil.ShuntRow("Int,Double,Float,Decimal,String,Char,Bool,DateTime"
                                     , null, null, null, null, null, null, null, null);

            var table = row.Table;
            var list  = table.ToList <NullableObjectClass>();

            Assert.IsTrue(list.Count == 1);

            var obj = list[0];

            Assert.IsNull(obj.Int);
            Assert.IsNull(obj.Double);
            Assert.IsNull(obj.Float);
            Assert.IsNull(obj.Decimal);
            Assert.IsNull(obj.String);
            Assert.IsNull(obj.Char);
            Assert.IsNull(obj.Bool);
            Assert.IsNull(obj.DateTime);
        }