public async void GetProducerChargeBand_GivenProducerSubmission_PreviousAmendmentChargeShouldBeRetrieved()
        {
            var schemeType = new schemeType()
            {
                approvalNo = "app", complianceYear = ComplianceYear.ToString()
            };
            var producerType = new producerType()
            {
                registrationNo = "no"
            };

            await calculator.GetProducerChargeBand(schemeType, producerType);

            A.CallTo(() => registeredProducerDataAccess.HasPreviousAmendmentCharge(producerType.registrationNo, ComplianceYear, schemeType.approvalNo))
            .MustHaveHappened(Repeated.Exactly.Once);
        }
        public async Task <ProducerCharge> GetProducerChargeBand(schemeType schmemeType, producerType producerType)
        {
            var complianceYear = int.Parse(schmemeType.complianceYear);

            var previousProducerSubmission =
                await registeredProducerDataAccess.GetProducerRegistration(producerType.registrationNo, complianceYear, schmemeType.approvalNo);

            var previousAmendmentCharge = registeredProducerDataAccess.HasPreviousAmendmentCharge(producerType.registrationNo, complianceYear, schmemeType.approvalNo);

            var chargeband = await environmentAgencyProducerChargeBandCalculator.GetProducerChargeBand(schmemeType, producerType);

            if (previousProducerSubmission != null && previousProducerSubmission.CurrentSubmission != null)
            {
                if (!previousAmendmentCharge && (producerType.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                                                 previousProducerSubmission.CurrentSubmission.EEEPlacedOnMarketBandType == (int)eeePlacedOnMarketBandType.Lessthan5TEEEplacedonmarket))
                {
                    return(chargeband);
                }
            }

            return(new ProducerCharge()
            {
                ChargeBandAmount = chargeband.ChargeBandAmount,
                Amount = 0
            });
        }