public void EMpStat_NotInAllowedlist_ReturnsFalse()
        {
            //arrange
            var dd28EmpStatTypeCode11Rule = new DD28Criteria1(_mock.Object);
            var param = new DD28SubModel()
            {
                LearningDeliveryObject = new MessageLearnerLearningDelivery()
                {
                },
                LearnerEmploymentStatusObj = new List <MessageLearnerLearnerEmploymentStatus>()
                {
                    new MessageLearnerLearnerEmploymentStatus()
                    {
                        EmpStat = 15,
                        EmploymentStatusMonitoring = new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring[]
                        {
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 5,
                                ESMType = "BIS"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28EmpStatTypeCode11Rule.Evaluate(param);

            //assert
            Assert.False(actual);
        }
        public bool Evaluate(DD28SubModel dd28SubModel)
        {
            // LearnerEmploymentStatus.EmpStat = 10  and
            // (EmploymentStatusMonitoring.ESMType = EII and EmploymentStatusMonitoring.ESMCode = 2) and
            // (EmploymentStatusMonitoring.ESMType = BSI and EmploymentStatusMonitoring.ESMCode = 3 or 4),

            //if the list contains 0 or more than 1 then return false, there can only be one LearnerEmpStatus obj
            //valid for a specific LD.
            if (dd28SubModel.LearnerEmploymentStatusObj.Count() == 0 ||
                dd28SubModel.LearnerEmploymentStatusObj.Count() > 1)
            {
                return(false);
            }

            //pick the first one
            var validLearnerEmpStatusObj = dd28SubModel.LearnerEmploymentStatusObj.FirstOrDefault();


            return(_allowedEmpStats.Contains(validLearnerEmpStatusObj.EmpStat.ToString()) &&
                   validLearnerEmpStatusObj.EmploymentStatusMonitoring.Any(x =>
                                                                           x.ESMType == _allowedESMtypePart1 && _allowedESMCodesPart1.Contains(x.ESMCode.ToString())) &&
                   validLearnerEmpStatusObj.EmploymentStatusMonitoring.Any(x =>
                                                                           x.ESMType == _allowedESMTypePart2 && _allowedESMCodesPart2.Contains(x.ESMCode.ToString()))
                   );
        }
        public void ESMTypeAndCode_NotInAllowedValues_ReturnsFalse()
        {
            //arrange
            var dd28EmpStatTypeCode11Rule = new DD28Criteria1(_mock.Object);
            var param = new DD28SubModel()
            {
                LearningDeliveryObject     = new LearningDelivery(),
                LearnerEmploymentStatusObj = new List <LearnerEmploymentStatus>()
                {
                    new LearnerEmploymentStatus()
                    {
                        EmpStat = 12,
                        EmploymentStatusMonitorings = new List <EmploymentStatusMonitoring>()
                        {
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "1",
                                ESMType = "DUMMy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28EmpStatTypeCode11Rule.Evaluate(param);

            //assert
            Assert.False(actual);
        }
        public MessageLearnerLearnerEmploymentStatus Evaluate(DD28SubModel dd28SubModel)
        {
            //pick the emp record that is in the range of learningdelivery plan startdate
            var result = dd28SubModel.LearnerEmploymentStatusObj?.FirstOrDefault(empStatus =>
                                                                                 empStatus.DateEmpStatApp >= dd28SubModel.LearningDeliveryObject.LearnStartDate &&
                                                                                 empStatus.DateEmpStatApp <= dd28SubModel.LearningDeliveryObject.LearnPlanEndDate);

            return(result);
        }
예제 #5
0
        public bool Evaluate(DD28SubModel dd28SubModel)
        {
            //if the list contains 0 or more than 1 then return false, there can only be one LearnerEmpStatus obj
            //valid for a specific LD.
            if (dd28SubModel.LearnerEmploymentStatusObj.Count() == 0 ||
                dd28SubModel.LearnerEmploymentStatusObj.Count() > 1)
            {
                return(false);
            }

            //pick the first one
            var validLearnerEmpStatusObj = dd28SubModel.LearnerEmploymentStatusObj.FirstOrDefault();


            return(dd28SubModel.LearningDeliveryObject.FundModel == 35 &&
                   _allowedEmpStats.Contains(validLearnerEmpStatusObj.EmpStat.ToString()) &&
                   validLearnerEmpStatusObj.EmploymentStatusMonitorings.Any(x =>
                                                                            x.ESMType == _allowedESMtype && _allowedESMCodes.Contains(x.ESMCode.ToString()))
                   );
        }
        public void valid_Allvalues_ReturnsTrue()
        {
            //arrange
            var dd28RuleFundModelAndEmpStatEmpCodeCheck = new DD28RuleCriteria2(_mock.Object);
            var param = new DD28SubModel()
            {
                LearningDeliveryObject = new LearningDelivery()
                {
                    FundModel = 35
                },
                LearnerEmploymentStatusObj =
                    new List <LearnerEmploymentStatus>()
                {
                    new LearnerEmploymentStatus()
                    {
                        EmpStat = 11,
                        EmploymentStatusMonitorings = new List <EmploymentStatusMonitoring>()
                        {
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "1",
                                ESMType = "BSI"
                            },
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "1",
                                ESMType = "DUmmy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28RuleFundModelAndEmpStatEmpCodeCheck.Evaluate(param);

            //assert
            Assert.True(actual);
        }
예제 #7
0
        public void ESMType_Invalid_ReturnsFalse()
        {
            //arrange
            var dd28Criteria3 = new DD28Criteria3(_mock.Object);
            var param         = new DD28SubModel()
            {
                LearningDeliveryObject = new LearningDelivery()
                {
                },
                LearnerEmploymentStatusObj =
                    new List <LearnerEmploymentStatus>()
                {
                    new LearnerEmploymentStatus()
                    {
                        EmpStat = 10,
                        EmploymentStatusMonitorings = new List <EmploymentStatusMonitoring>()
                        {
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "2",
                                ESMType = "Dummy2"
                            },
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "1",
                                ESMType = "DUmmy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28Criteria3.Evaluate(param);

            //assert
            Assert.False(actual);
        }
예제 #8
0
        public void ESMTypeCodePart1_valid_ESMTypeCodePart2_valid_ReturnsTrue2()
        {
            //arrange

            var dd28Criteria3 = new DD28Criteria3(_mock.Object);
            var param         = new DD28SubModel()
            {
                LearningDeliveryObject = new LearningDelivery()
                {
                },
                LearnerEmploymentStatusObj = new List <LearnerEmploymentStatus>()
                {
                    new LearnerEmploymentStatus()
                    {
                        EmpStat = 10,
                        EmploymentStatusMonitorings = new List <EmploymentStatusMonitoring>()
                        {
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "2",
                                ESMType = "EII"
                            },
                            new EmploymentStatusMonitoring()
                            {
                                ESMCode = "4",
                                ESMType = "BSI"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28Criteria3.Evaluate(param);

            //assert
            Assert.True(actual);
        }
        public void Invalid_EMPStat_ReturnsFalse()
        {
            //arrange
            var dd28RuleFundModelAndEmpStatEmpCodeCheck = new DD28RuleCriteria2(_mock.Object);
            var param = new DD28SubModel()
            {
                LearningDeliveryObject = new MessageLearnerLearningDelivery()
                {
                    FundModel = 35
                },
                LearnerEmploymentStatusObj = new List <MessageLearnerLearnerEmploymentStatus>()
                {
                    new MessageLearnerLearnerEmploymentStatus()
                    {
                        EmpStat = 110,
                        EmploymentStatusMonitoring = new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring[]
                        {
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 3,
                                ESMType = "BSI"
                            },
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 1,
                                ESMType = "DUmmy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28RuleFundModelAndEmpStatEmpCodeCheck.Evaluate(param);

            //assert
            Assert.False(actual);
        }
        public void EmpStatESMTypeAndCode_InAllowedValues_ReturnsTrue()
        {
            //arrange
            var dd28EmpStatTypeCode11Rule = new DD28Criteria1(_mock.Object);
            var param = new DD28SubModel()
            {
                LearningDeliveryObject = new MessageLearnerLearningDelivery()
                {
                },
                LearnerEmploymentStatusObj = new List <MessageLearnerLearnerEmploymentStatus>()
                {
                    new MessageLearnerLearnerEmploymentStatus()
                    {
                        EmpStat = 11,
                        EmploymentStatusMonitoring = new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring[]
                        {
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 3,
                                ESMType = "BSI"
                            },
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 1,
                                ESMType = "DUmmy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28EmpStatTypeCode11Rule.Evaluate(param);

            //assert
            Assert.True(actual);
        }
예제 #11
0
        public void ESMTypeCodePart1_valid_ESMTypeCodePart2_Invalid_ReturnsFalse()
        {
            //arrange
            var dd28Criteria3 = new DD28Criteria3(_mock.Object);
            var param         = new DD28SubModel()
            {
                LearningDeliveryObject = new MessageLearnerLearningDelivery()
                {
                },
                LearnerEmploymentStatusObj = new List <MessageLearnerLearnerEmploymentStatus>()
                {
                    new MessageLearnerLearnerEmploymentStatus()
                    {
                        EmpStat = 10,
                        EmploymentStatusMonitoring = new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring[]
                        {
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 2,
                                ESMType = "EII"
                            },
                            new MessageLearnerLearnerEmploymentStatusEmploymentStatusMonitoring()
                            {
                                ESMCode = 1,
                                ESMType = "DUmmy"
                            }
                        }
                    }
                }
            };

            //act
            var actual = dd28Criteria3.Evaluate(param);

            //assert
            Assert.False(actual);
        }