Пример #1
0
        public void ArgumentOutOfRangeExceptionShouldBeThrown(decimal annualConsumption)
        {
            var tariff = new PackagedElectricityTariff()
            {
                Name                 = string.Empty,
                AnnualTariffCost     = 1,
                AnnualTariffAmount   = 1,
                ExtraConsumptionCost = 1
            };

            Assert.Throws <ArgumentOutOfRangeException>(() => tariff.CalculateAnnualCosts(annualConsumption));
        }
Пример #2
0
        public void InvalidOperationExceptionShouldBeThrown(decimal annualTariffCost, decimal annualTariffAmount,
                                                            decimal extraConsumptionCost)
        {
            var tariff = new PackagedElectricityTariff()
            {
                Name                 = string.Empty,
                AnnualTariffCost     = annualTariffCost,
                AnnualTariffAmount   = annualTariffAmount,
                ExtraConsumptionCost = extraConsumptionCost
            };

            Assert.Throws <InvalidOperationException>(() => tariff.CalculateAnnualCosts(1));
        }
Пример #3
0
        public void IsAnnualCostCalculatedCorrectly(decimal annualTariffCost, decimal annualTariffAmount,
                                                    decimal extraConsumptionCost, decimal annualConsumption, decimal expectedAnnualCost)
        {
            var tariff = new PackagedElectricityTariff()
            {
                Name                 = string.Empty,
                AnnualTariffCost     = annualTariffCost,
                AnnualTariffAmount   = annualTariffAmount,
                ExtraConsumptionCost = extraConsumptionCost
            };

            var actualAnnualCost = tariff.CalculateAnnualCosts(annualConsumption);

            Assert.Equal(expectedAnnualCost, actualAnnualCost);
        }