示例#1
0
        public void TestMappingForPayRulePreEntityIsInputIsEmpty()
        {
            var mapper     = new EmployeeMapper();
            var mappedData = mapper.MapPayRulePre(null);

            Assert.NotNull(mappedData);
        }
示例#2
0
        public void TestMappingForPayRulePreEntity()
        {
            var employees = new List <Employee>();

            for (int i = 1; i <= 12; i++)
            {
                employees.Add(new Employee
                {
                    FirstName    = "FirstName" + i,
                    LastName     = "LastName" + i,
                    PersonNumber = "PersonNumber" + i,
                    PayRuleName  = "PayRuleName1"
                });
            }
            for (int i = 13; i <= 24; i++)
            {
                employees.Add(new Employee
                {
                    FirstName    = "FirstName" + i,
                    LastName     = "LastName" + i,
                    PersonNumber = "PersonNumber" + i,
                    PayRuleName  = "PayRuleName2"
                });
            }

            var mapper     = new EmployeeMapper();
            var mappedData = mapper.MapPayRulePre(employees);

            Assert.NotNull(mappedData);
            Assert.AreEqual(24, mappedData.Count);
            for (int i = 1; i <= 12; i++)
            {
                Assert.AreEqual("LastName" + i + ", " + "FirstName" + i, mappedData[i - 1].FullName);
                Assert.AreEqual("PersonNumber" + i, mappedData[i - 1].PersonNumber);
                Assert.AreEqual("PayRuleName1", mappedData[i - 1].PayRuleName);
                Assert.AreEqual(i, mappedData[i - 1].Sequence);
            }
            for (int i = 13; i <= 24; i++)
            {
                Assert.AreEqual("LastName" + i + ", " + "FirstName" + i, mappedData[i - 1].FullName);
                Assert.AreEqual("PersonNumber" + i, mappedData[i - 1].PersonNumber);
                Assert.AreEqual("PayRuleName2", mappedData[i - 1].PayRuleName);
                Assert.AreEqual(i - 12, mappedData[i - 1].Sequence);
            }
        }