Example #1
0
        public void TestMappingForPayRuleEntityIsInputIsEmpty()
        {
            var mapper     = new EmployeeMapper();
            var mappedData = mapper.MapPayRule(null);

            Assert.NotNull(mappedData);
        }
Example #2
0
        public void TestMappingForPayRuleEntity()
        {
            var payRulePreList = new List <PayRulePre>();

            for (int i = 1; i <= 12; i++)
            {
                payRulePreList.Add(new PayRulePre
                {
                    FullName     = "LastName" + i + ", " + "FirstName" + i,
                    PersonNumber = "PersonNumber" + i,
                    PayRuleName  = "PayRuleName1",
                    Sequence     = i
                });
            }
            for (int i = 13; i <= 24; i++)
            {
                payRulePreList.Add(new PayRulePre
                {
                    FullName     = "LastName" + i + ", " + "FirstName" + i,
                    PersonNumber = "PersonNumber" + i,
                    PayRuleName  = "PayRuleName2",
                    Sequence     = i - 12
                });
            }

            var mapper     = new EmployeeMapper();
            var mappedData = mapper.MapPayRule(payRulePreList);

            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);

                Assert.AreEqual(GetTestNameBySequence(i), mappedData[i - 1].TestName);
            }
            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(GetTestNameBySequence(i - 12), mappedData[i - 1].TestName);
            }
        }