Exemplo n.º 1
0
        public void RemoveCarryOversRemovesFromInternalCollectionWhereFundingLineCodeMatches()
        {
            string fundingLineCode = NewRandomString();

            ProfilingCarryOver customCarryOver = NewCarryOver(_ => _.WithFundingLineCode(fundingLineCode));
            ProfilingCarryOver differentFundingLineCarryOver = NewCarryOver();

            GivenTheCarryOver(customCarryOver);
            AndTheCarryOver(differentFundingLineCarryOver);

            WhenTheFundingLineCarryOverIsRemoved(fundingLineCode);

            _publishedProviderVersion
            .CarryOvers
            .Should()
            .BeEquivalentTo(differentFundingLineCarryOver);
        }
Exemplo n.º 2
0
        private bool HasNoCarryOverChanges(PublishedProviderVersion priorState,
                                           PublishedProviderVersion refreshState,
                                           ProviderVariationContext providerVariationContext)
        {
            bool hasNoCarryOverChanges = true;

            foreach (ProfilingCarryOver carryOver in priorState.CarryOvers ?? ArraySegment <ProfilingCarryOver> .Empty)
            {
                ProfilingCarryOver latestCustomProfile = refreshState.CarryOvers?.SingleOrDefault(_ => _.FundingLineCode == carryOver.FundingLineCode);

                if ((latestCustomProfile?.Amount).GetValueOrDefault() != carryOver.Amount)
                {
                    providerVariationContext.AddAffectedFundingLineCode(carryOver.FundingLineCode);

                    hasNoCarryOverChanges = false;
                }
            }

            return(hasNoCarryOverChanges);
        }
Exemplo n.º 3
0
        public void ThenTheUpsertedProviderVersionForHasTheFollowingFundingLineOverPayments(string providerId,
                                                                                            IEnumerable <ExpectedFundingLineOverPayment> expectedFundingLineOverPayments)
        {
            PublishedProviderVersion publishedProviderVersion = GetUpsertedPublishedProviderVersion(providerId);

            IEnumerable <ProfilingCarryOver> carryOvers = publishedProviderVersion.CarryOvers ?? new List <ProfilingCarryOver>();

            foreach (ExpectedFundingLineOverPayment expectedFundingLineOverPayment in expectedFundingLineOverPayments)
            {
                string fundingLineCode = expectedFundingLineOverPayment.FundingLineCode;

                ProfilingCarryOver carryOver = carryOvers.FirstOrDefault(_ => _.FundingLineCode == fundingLineCode);

                carryOver
                .Should()
                .BeEquivalentTo(new ProfilingCarryOver
                {
                    FundingLineCode = fundingLineCode,
                    Type            = ProfilingCarryOverType.DSGReProfiling,
                    Amount          = expectedFundingLineOverPayment.OverPayment
                });
            }
        }
Exemplo n.º 4
0
        private void AndTheFundingLineOverPaymentShouldBe(decimal?expectedOverPayment)
        {
            IEnumerable <ProfilingCarryOver> overPayments = VariationContext.RefreshState.CarryOvers;

            if (expectedOverPayment == null)
            {
                overPayments
                .Should()
                .BeNull();
            }
            else
            {
                ProfilingCarryOver carryOver = overPayments.FirstOrDefault(_ => _.FundingLineCode == _fundingLineCode);

                carryOver
                .Should()
                .BeEquivalentTo(new ProfilingCarryOver
                {
                    Type            = ProfilingCarryOverType.DSGReProfiling,
                    Amount          = expectedOverPayment.GetValueOrDefault(),
                    FundingLineCode = _fundingLineCode
                });
            }
        }
Exemplo n.º 5
0
 private void AndTheCarryOver(ProfilingCarryOver carryOver)
 => GivenTheCarryOver(carryOver);
Exemplo n.º 6
0
 private void GivenTheCarryOver(ProfilingCarryOver carryOver)
 {
     _publishedProviderVersion.CarryOvers ??= new List <ProfilingCarryOver>();
     _publishedProviderVersion.CarryOvers.Add(carryOver);
 }