public void LearnerLearningDeliveryAppFinRecordUplifter_CleanRunShouldIncrementDates()
        {
            // Arrange
            var ruleProvider            = new RuleProvider();
            var yearUpdateConfiguration = new Mock <IYearUpdateConfiguration>();

            yearUpdateConfiguration.Setup(s => s.ShouldUpdateDate(It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            var learnerLearningDeliveryAppFinRecordUplifter = new LearnerLearningDeliveryAppFinRecordUplifter(ruleProvider, yearUpdateConfiguration.Object);

            var messageLearnerLearningDeliveryAppFinRecord = new MessageLearnerLearningDeliveryAppFinRecord
            {
                AFinDate = new DateTime(2019, 01, 02)
            };

            // Act
            var result = learnerLearningDeliveryAppFinRecordUplifter.Process(messageLearnerLearningDeliveryAppFinRecord);

            // Assert
            yearUpdateConfiguration.Verify(v => v.ShouldUpdateDate("MessageLearnerLearningDeliveryAppFinRecord", "AFinDate"), Times.Once);

            result.Should().NotBeNull();

            result.AFinDate.Should().Be(new DateTime(2020, 01, 02));
        }
예제 #2
0
        private void AddNewPmrAppFinRecord(List <MessageLearnerLearningDeliveryAppFinRecord> appFinRecords, Price priceEpisode)
        {
            var pmr = appFinRecords.SingleOrDefault(a => a.AFinType == LearnDelAppFinType.PMR.ToString());

            if (pmr == null)
            {
                pmr = new MessageLearnerLearningDeliveryAppFinRecord()
                {
                    AFinType = LearnDelAppFinType.PMR.ToString()
                };
                appFinRecords.Add(pmr);
            }

            pmr.AFinCode            = (int)LearnDelAppFinCode.TotalAssessmentPrice;
            pmr.AFinCodeSpecified   = true;
            pmr.AFinAmount          = Convert.ToInt32(priceEpisode.TotalAssessmentPrice);
            pmr.AFinAmountSpecified = true;
            pmr.AFinDate            = priceEpisode.TotalAssessmentPriceEffectiveDate.ToDate();
            pmr.AFinDateSpecified   = true;
        }
예제 #3
0
        private void AddTnpAppFinRecordForAssessmentPrice(List <MessageLearnerLearningDeliveryAppFinRecord> appFinRecords, Price priceEpisode)
        {
            var tnp = appFinRecords.SingleOrDefault(a =>
                                                    a.AFinType == LearnDelAppFinType.TNP.ToString() &&
                                                    a.AFinCode == (int)LearnDelAppFinCode.TotalAssessmentPrice);

            if (tnp == null)
            {
                tnp = new MessageLearnerLearningDeliveryAppFinRecord()
                {
                    AFinType          = LearnDelAppFinType.TNP.ToString(),
                    AFinCode          = (int)LearnDelAppFinCode.TotalAssessmentPrice,
                    AFinCodeSpecified = true
                };
                appFinRecords.Add(tnp);
            }

            tnp.AFinAmount          = Convert.ToInt32(priceEpisode.TotalAssessmentPrice);
            tnp.AFinAmountSpecified = true;
            tnp.AFinDate            = priceEpisode.TotalAssessmentPriceEffectiveDate.ToDate();
            tnp.AFinDateSpecified   = true;
        }
예제 #4
0
        private void AddNewTnpAppFinRecordForTrainingPrice(List <MessageLearnerLearningDeliveryAppFinRecord> appFinRecords, Price priceEpisode)
        {
            var tnp = appFinRecords.SingleOrDefault(a => a.AFinType == "TNP");

            if (tnp == null)
            {
                tnp = new MessageLearnerLearningDeliveryAppFinRecord()
                {
                    AFinType = "TNP"
                };
                appFinRecords.Add(tnp);
            }

            tnp.AFinCode            = (int)LearnDelAppFinCode.TotalTrainingPrice;
            tnp.AFinCodeSpecified   = true;
            tnp.AFinAmount          = Convert.ToInt32(priceEpisode.TotalTrainingPrice);
            tnp.AFinAmountSpecified = true;

            if (!string.IsNullOrWhiteSpace(priceEpisode.TotalTrainingPriceEffectiveDate))
            {
                tnp.AFinDate          = priceEpisode.TotalTrainingPriceEffectiveDate.ToDate();
                tnp.AFinDateSpecified = true;
            }
        }