Ejemplo n.º 1
0
        public void MultiplePaymentPeriodsOnlyGenerateSingleEarningsLink()
        {
            var earningsAndPaymentsBuilder   = new EarningsAndPaymentsBuilder() as IEarningsAndPaymentsBuilder;
            var paymentAndLearningDeliveries = new List <PaymentAndLearningDelivery>();
            var periodisedValuesForPayment   = new List <ApprenticeshipPriceEpisodePeriodisedValues>();

            var periodisedValuesType = typeof(ApprenticeshipPriceEpisodePeriodisedValues);

            for (int i = 1; i <= 14; i++)
            {
                paymentAndLearningDeliveries.Add(new PaymentAndLearningDelivery
                {
                    Payment = new Payment {
                        Amount = (decimal)Math.Pow(2, i), CollectionPeriod = (byte)i, TransactionType = 4
                    },
                    LearningDelivery = new AecLearningDelivery {
                        AimSequenceNumber = 123
                    }
                });
            }

            var periodisedValues = new ApprenticeshipPriceEpisodePeriodisedValues {
                AimSeqNumber = 123, AttributeName = "PriceEpisodeFirstEmp1618Pay", Period_1 = 100
            };

            periodisedValuesForPayment.Add(periodisedValues);

            var result = earningsAndPaymentsBuilder.Build(paymentAndLearningDeliveries, periodisedValuesForPayment);

            result.TotalPaymentsYearToDate.Should().Be((decimal)Math.Pow(2, 15) - 2);
            result.TotalEarnings.Should().Be(100);
        }
Ejemplo n.º 2
0
        public void BuildAssignsAcrossPeriods()
        {
            var earningsAndPaymentsBuilder   = new EarningsAndPaymentsBuilder() as IEarningsAndPaymentsBuilder;
            var paymentAndLearningDeliveries = new List <PaymentAndLearningDelivery>();
            var periodisedValuesForPayment   = new List <ApprenticeshipPriceEpisodePeriodisedValues>();

            var periodisedValuesType = typeof(ApprenticeshipPriceEpisodePeriodisedValues);

            for (int i = 1; i <= 14; i++)
            {
                paymentAndLearningDeliveries.Add(new PaymentAndLearningDelivery
                {
                    Payment = new Payment {
                        Amount = (decimal)Math.Pow(2, i), CollectionPeriod = (byte)i, TransactionType = 4
                    },
                    LearningDelivery = new AecLearningDelivery {
                        AimSequenceNumber = i
                    }
                });
            }

            for (int i = 1; i <= 12; i++)
            {
                var periodisedValues = new ApprenticeshipPriceEpisodePeriodisedValues {
                    AimSeqNumber = i, AttributeName = "PriceEpisodeFirstEmp1618Pay"
                };

                PropertyInfo pvInstance = periodisedValuesType.GetProperty($"Period_{i}");
                pvInstance.SetValue(periodisedValues, (decimal)Math.Pow(2, i) + 1000);

                periodisedValuesForPayment.Add(periodisedValues);
            }

            var result = earningsAndPaymentsBuilder.Build(paymentAndLearningDeliveries, periodisedValuesForPayment);

            result.TotalPaymentsYearToDate.Should().Be((decimal)Math.Pow(2, 15) - 2);
            result.TotalEarnings.Should().Be((decimal)Math.Pow(2, 13) - 2 + 12000);
        }