Exemplo n.º 1
0
        public async void GetProducerChargeBand_Morethanorequalto5TEEEplacedonmarket_GreaterthanonemillionpoundsTurnover_VATRegistered_ProducerChargeBandAShouldBeRetrieved()
        {
            // Arrange
            var producer = new producerType
            {
                annualTurnoverBand    = annualTurnoverBandType.Greaterthanonemillionpounds,
                VATRegistered         = true,
                eeePlacedOnMarketBand = eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket
            };

            // Act
            var result = await producerChargeBandCalculator.GetProducerChargeBand(A.Dummy <schemeType>(), producer);

            // Assert
            A.CallTo(() => fetchProducerCharge.GetCharge(ChargeBand.A)).MustHaveHappened(Repeated.Exactly.Once);
        }
        public async Task <ProducerCharge> GetProducerChargeBand(schemeType scheme, producerType producer)
        {
            ChargeBand band;

            if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Lessthan5TEEEplacedonmarket)
            {
                band = ChargeBand.E;
            }
            else
            {
                if (producer.annualTurnoverBand == annualTurnoverBandType.Greaterthanonemillionpounds &&
                    producer.VATRegistered &&
                    producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket)
                {
                    band = ChargeBand.A;
                }
                else if (producer.annualTurnoverBand == annualTurnoverBandType.Lessthanorequaltoonemillionpounds &&
                         producer.VATRegistered &&
                         producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket)
                {
                    band = ChargeBand.B;
                }
                else if (producer.annualTurnoverBand == annualTurnoverBandType.Greaterthanonemillionpounds &&
                         !producer.VATRegistered &&
                         producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket)
                {
                    band = ChargeBand.D;
                }
                else
                {
                    band = ChargeBand.C;
                }
            }

            return(await fetchProducerCharge.GetCharge(band));
        }
        public async Task <ProducerCharge> GetProducerChargeBand(schemeType scheme, producerType producer)
        {
            var        producerCountry = producer.GetProducerCountry();
            ChargeBand band;

            if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Lessthan5TEEEplacedonmarket)
            {
                band = ChargeBand.E;
            }
            else
            {
                if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                    producer.VATRegistered && producerCountry == countryType.UKENGLAND)
                {
                    band = ChargeBand.A2;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         producer.VATRegistered &&
                         (producerCountry != countryType.UKENGLAND &&
                          producerCountry != countryType.UKSCOTLAND &&
                          producerCountry != countryType.UKWALES &&
                          producerCountry != countryType.UKNORTHERNIRELAND))
                {
                    band = ChargeBand.D3;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         producer.VATRegistered &&
                         (producerCountry == countryType.UKSCOTLAND ||
                          producerCountry == countryType.UKWALES ||
                          producerCountry == countryType.UKNORTHERNIRELAND) &&
                         producer.annualTurnoverBand == annualTurnoverBandType.Greaterthanonemillionpounds)
                {
                    band = ChargeBand.A;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         producer.VATRegistered &&
                         (producerCountry == countryType.UKSCOTLAND ||
                          producerCountry == countryType.UKWALES ||
                          producerCountry == countryType.UKNORTHERNIRELAND) &&
                         producer.annualTurnoverBand == annualTurnoverBandType.Lessthanorequaltoonemillionpounds)
                {
                    band = ChargeBand.B;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         producerCountry == countryType.UKENGLAND &&
                         !producer.VATRegistered)
                {
                    band = ChargeBand.C2;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         !producer.VATRegistered &&
                         (producerCountry != countryType.UKENGLAND &&
                          producerCountry != countryType.UKSCOTLAND &&
                          producerCountry != countryType.UKWALES &&
                          producerCountry != countryType.UKNORTHERNIRELAND))
                {
                    band = ChargeBand.D2;
                }
                else if (producer.eeePlacedOnMarketBand == eeePlacedOnMarketBandType.Morethanorequalto5TEEEplacedonmarket &&
                         !producer.VATRegistered &&
                         (producerCountry == countryType.UKSCOTLAND ||
                          producerCountry == countryType.UKWALES ||
                          producerCountry == countryType.UKNORTHERNIRELAND) &&
                         producer.annualTurnoverBand == annualTurnoverBandType.Greaterthanonemillionpounds)
                {
                    band = ChargeBand.D;
                }
                else
                {
                    band = ChargeBand.C;
                }
            }

            return(await fetchProducerCharge.GetCharge(band));
        }
Exemplo n.º 4
0
        public async void GetProducerChargeBand_Lessthanorequalto5TEEEplacedonmarket_ProducerChargeForChargeBandShouldBeReturned()
        {
            //Arrange
            var countryType = new countryType();
            var eeePlacedOnMarketBandType = new eeePlacedOnMarketBandType();
            var annualTurnoverBandType    = new annualTurnoverBandType();
            var producerCharge            = new ProducerCharge();

            eeePlacedOnMarketBandType = eeePlacedOnMarketBandType.Lessthan5TEEEplacedonmarket;
            var producer = SetUpProducer(countryType, eeePlacedOnMarketBandType, annualTurnoverBandType, false);

            A.CallTo(() => fetchProducerCharge.GetCharge(ChargeBand.E)).Returns(producerCharge);

            // Act
            var result = await environmentAgencyProducerChargeBandCalculator.GetProducerChargeBand(A.Dummy <schemeType>(), producer);

            // Assert
            Assert.Equal(producerCharge, result);
        }