Example #1
0
        public void GetLatestRefundPaymentWithEarningEvent()
        {
            var paymentOne = new PaymentBuilder()
                             .With(p => p.LearningStartDate, null)
                             .Build();
            var paymentTwo = new PaymentBuilder()
                             .With(p => p.LearningStartDate, null)
                             .With(p => p.LearnerReferenceNumber, "NotLearnerReferenceNumber").Build();

            var payments = new List <Payment>()
            {
                paymentOne,
                paymentTwo,
            };

            var recordKey = new RecordKey(
                PaymentBuilder.LearnerReferenceNumber,
                PaymentBuilder.LearnerUln,
                PaymentBuilder.LearningAimReference,
                PaymentBuilder.LearningStartDate,
                PaymentBuilder.ProgrammeType,
                PaymentBuilder.StandardCode,
                PaymentBuilder.FrameworkCode,
                PaymentBuilder.PathwayCode,
                PaymentBuilder.ReportingAimFundingLineType,
                PaymentBuilder.PriceEpisodeIdentifier,
                PaymentBuilder.ContractType);

            NewBuilder().GetLatestRefundPaymentWithEarningEventForRecord(recordKey, payments).Should().BeSameAs(paymentOne);
        }
Example #2
0
        public void GetAmountForPaymentsForFundingSourceAndTransactionType()
        {
            var paymentOne   = new PaymentBuilder().With <byte>(p => p.TransactionType, 1).With <byte>(p => p.FundingSource, 1).With(p => p.Amount, 1.1m).Build();
            var paymentTwo   = new PaymentBuilder().With <byte>(p => p.TransactionType, 2).With <byte>(p => p.FundingSource, 2).With(p => p.Amount, 1.2m).Build();
            var paymentThree = new PaymentBuilder().With <byte>(p => p.TransactionType, 1).With <byte>(p => p.FundingSource, 3).With(p => p.Amount, 1.3m).Build();
            var paymentFour  = new PaymentBuilder().With <byte>(p => p.TransactionType, 2).With <byte>(p => p.FundingSource, 4).With(p => p.Amount, 1.4m).Build();
            var paymentFive  = new PaymentBuilder().With <byte>(p => p.TransactionType, 3).With <byte>(p => p.FundingSource, 5).With(p => p.Amount, 1.5m).Build();

            var payments = new List <Payment>()
            {
                paymentOne,
                paymentTwo,
                paymentThree,
                paymentFour,
                paymentFive,
            };

            NewBuilder().GetAmountForPaymentsForFundingSourceAndTransactionType(payments, new List <byte>()
            {
                1
            }, new List <byte>()
            {
                1, 3,
            }).Should().Be(1.1m);
        }
Example #3
0
        public void GetEarningForPayment_NoMatchingEarnings()
        {
            var payment = new PaymentBuilder().Build();

            var earningsLookup = new Dictionary <Guid, Earning>()
            {
                [Guid.Empty] = new EarningBuilder().Build(),
            };

            NewBuilder().GetEarningForPayment(earningsLookup, payment).Should().BeNull();
        }
Example #4
0
        public void GetLatestRefundPaymentWithEarningEvent_NoEarningEvents()
        {
            var paymentOne = new PaymentBuilder().With(p => p.EarningEventId, null).Build();
            var paymentTwo = new PaymentBuilder().With(p => p.EarningEventId, Guid.Empty).Build();

            var payments = new List <Payment>()
            {
                paymentOne,
                paymentTwo,
            };

            NewBuilder().GetLatestRefundPaymentWithEarningEventForRecord(new RecordKey(), payments).Should().BeNull();
        }
Example #5
0
        public void GetLatestPaymentWithEarningEvent_NoEarningEvents()
        {
            var paymentOne = new PaymentBuilder().With(p => p.EarningEventId, null).Build();
            var paymentTwo = new PaymentBuilder().With(p => p.EarningEventId, new Guid()).Build();

            var payments = new List <Payment>()
            {
                paymentOne,
                paymentTwo,
            };

            NewBuilder().GetLatestPaymentWithEarningEvent(payments).Should().BeNull();
        }
Example #6
0
        public void GetLatestPaymentWithEarningEvent_DeliveryPeriod()
        {
            var paymentOne = new PaymentBuilder().With <byte>(p => p.CollectionPeriod, 2).With <byte>(p => p.DeliveryPeriod, 2).Build();
            var paymentTwo = new PaymentBuilder().With <byte>(p => p.CollectionPeriod, 2).With <byte>(p => p.DeliveryPeriod, 3).Build();

            var payments = new List <Payment>()
            {
                paymentOne,
                paymentTwo,
            };

            NewBuilder().GetLatestPaymentWithEarningEvent(payments).Should().BeSameAs(paymentTwo);
        }
Example #7
0
        public void GetEarningForPayment()
        {
            var payment = new PaymentBuilder().With(p => p.EarningEventId, EarningBuilder.EventId).Build();

            var matchingEarning    = new EarningBuilder().Build();
            var nonMatchingEarning = new EarningBuilder().Build();

            var earningsLookup = new Dictionary <Guid, Earning>()
            {
                [Guid.Empty]             = nonMatchingEarning,
                [EarningBuilder.EventId] = matchingEarning,
            };

            NewBuilder().GetEarningForPayment(earningsLookup, payment).Should().BeSameAs(matchingEarning);
        }
Example #8
0
        public void GetEarningForPayment_NoEarnings()
        {
            var payment = new PaymentBuilder().Build();

            NewBuilder().GetEarningForPayment(new Dictionary <Guid, Earning>(), payment).Should().BeNull();
        }
Example #9
0
        public void GetEarningForPayment_NullEarningEventId()
        {
            var payment = new PaymentBuilder().With(e => e.EarningEventId, null).Build();

            NewBuilder().GetEarningForPayment(new Dictionary <Guid, Earning>(), payment).Should().BeNull();
        }