/// <summary>
        /// Start the CreateInf Dialog with File Info
        /// </summary>
        /// <param name="chargeBandList">ChargeBand List</param>
        /// <param name="info">File Info - Tarif Name; Tarif ID; Default ChargeBand; Price for Meter Unit</param>
        public CreateInf(ObservableCollection <ChargeBand> chargeBandList, string[] info)
        {
            CbListe = chargeBandList;
            InitializeComponent();
            comboDefault.ItemsSource       = CbListe;
            comboDefault.DisplayMemberPath = "CBName";
            comboDefault.SelectedIndex     = 0;

            // Set File Info if already exist
            if (info != null)
            {
                txtName.Text  = info[0];
                txtIdent.Text = info[1];
                txtMeter.Text = info[3];
                ChargeBand defaultCB = null;
                foreach (ChargeBand item in CbListe)
                {
                    if (item.CBShortName == info[2])
                    {
                        defaultCB = item;
                    }
                }
                comboDefault.SelectedItem = defaultCB;
            }
        }
Example #2
0
        public async Task <ProducerCharge> GetCharge(ChargeBand chargeBand)
        {
            var currentChargeBandAmount = await producerChargeCalculatorDataAccess.FetchCurrentChargeBandAmount(chargeBand);

            return(new ProducerCharge()
            {
                ChargeBandAmount = currentChargeBandAmount,
                Amount = currentChargeBandAmount.Amount
            });
        }
Example #3
0
        public ProducerCharge GetCharge(ChargeBand chargeBand)
        {
            var currentChargeBandAmount = producerChargeCalculatorDataAccess.FetchCurrentChargeBandAmount(chargeBand);

            return(new ProducerCharge()
            {
                ChargeBandAmount = currentChargeBandAmount,
                Amount = currentChargeBandAmount.Amount
            });
        }
Example #4
0
            public RuleResult Evaluate(ChargeBand producerChargeBand, statusType producerStatus = statusType.A)
            {
                var producer = new producerType()
                {
                    status = producerStatus
                };

                var scheme = new schemeType()
                {
                    complianceYear = "2016"
                };

                return(producerChargeBandChange.Evaluate(scheme, producer, A.Dummy <Guid>()));
            }
Example #5
0
        public async Task <ChargeBandAmount> FetchCurrentChargeBandAmount(ChargeBand chargeBandType)
        {
            if (currentProducerChargeBandAmounts == null)
            {
                /* For now we only have one charge band amount for each type, so
                 * we can fetch them all. When new charge band amounts are added,
                 * this query will need to select only latest charge band amount
                 * for each charge band type.
                 */
                currentProducerChargeBandAmounts = await context
                                                   .ChargeBandAmounts
                                                   .ToDictionaryAsync(pcb => pcb.ChargeBand, pcb => pcb);
            }

            return(currentProducerChargeBandAmounts[chargeBandType]);
        }
        public ChargeBandAmount FetchCurrentChargeBandAmount(ChargeBand chargeBandType)
        {
            if (currentProducerChargeBandAmounts == null)
            {
                /* For now we only have one charge band amount for each type, so
                * we can fetch them all. When new charge band amounts are added,
                * this query will need to select only latest charge band amount
                * for each charge band type.
                */
                currentProducerChargeBandAmounts = context
                    .ChargeBandAmounts
                    .ToDictionary(pcb => pcb.ChargeBand, pcb => pcb);
            }

            return currentProducerChargeBandAmounts[chargeBandType];
        }
 public ChargeBandAmount FetchChargeBandAmount(ChargeBand chargeBand)
 {
     return model.ChargeBandAmounts.First(pcb => pcb.ChargeBand == (int)chargeBand);
 }
Example #8
0
 public ChargeBandAmount(Guid id, ChargeBand chargeBand, decimal amount)
 {
     Id         = id;
     ChargeBand = chargeBand;
     Amount     = amount;
 }
            public RuleResult Evaluate(ChargeBand producerChargeBand, statusType producerStatus = statusType.A)
            {
                var producer = new producerType()
                {
                    status = producerStatus
                };

                var scheme = new schemeType()
                {
                    complianceYear = "2016"
                };

                A.CallTo(() => ProducerChargeBandCalculator.GetProducerChargeBand(A<annualTurnoverBandType>._, A<bool>._, A<eeePlacedOnMarketBandType>._))
                    .Returns(producerChargeBand);

                return producerChargeBandChange.Evaluate(scheme, producer, A.Dummy<Guid>());
            }
 public ChargeBandAmount(Guid id, ChargeBand chargeBand, decimal amount)
 {
     Id = id;
     ChargeBand = chargeBand;
     Amount = amount;
 }
Example #11
0
        public async void GetCharge_GivenChargeBandAmount_ProducerChargeShouldBeReturned(ChargeBand band)
        {
            var chargeBandAmount = new ChargeBandAmount(Guid.NewGuid(), band, 1);

            A.CallTo(() => producerChargeCalculatorDataAccess.FetchCurrentChargeBandAmount(band)).Returns(chargeBandAmount);

            var result = await fetchProducerCharge.GetCharge(band);

            Assert.Equal(result.Amount, chargeBandAmount.Amount);
            Assert.Equal(result.ChargeBandAmount.ChargeBand, chargeBandAmount.ChargeBand);
        }
Example #12
0
        public async void GetCharge_GivenChargeBand_ChargeBandAmountShouldBeRetrieved(ChargeBand band)
        {
            await fetchProducerCharge.GetCharge(band);

            A.CallTo(() => producerChargeCalculatorDataAccess.FetchCurrentChargeBandAmount(band)).MustHaveHappened(Repeated.Exactly.Once);
        }
Example #13
0
 public ChargeBandAmount FetchChargeBandAmount(ChargeBand chargeBand)
 {
     return(model.ChargeBandAmounts.First(pcb => pcb.ChargeBand == (int)chargeBand));
 }