Пример #1
0
        public void Calculate_IfBasicTariff_ConsumptionIsCorrect_ExpectedResult(int consumption, int expectedResult)
        {
            BasicTariffProductSetUp();

            _product.Calculate(consumption);

            Assert.Equal(expectedResult, _product.Payment);
            Assert.Equal(ProductContants.BasicTarrifProductName, _product.Name);
        }
Пример #2
0
        public void Calculate_IfBaseTariff_BaseMonthCostCloseToMaxInt_ThrowOverflowException(int baseCost, int consumption)
        {
            var validator = new TariffCalculationSettingsValidator();
            var settings  = new TariffCalculationSettings(baseMonthCost: baseCost);

            _productFactory = new ElectricityProductFactory(validator);
            _product        = _productFactory.Create(settings, TariffType.Base).FirstOrDefault();

            Assert.Throws <OverflowException>(() => _product.Calculate(consumption));
        }