public void LocalText() { var call = new TextCall(2, TestCalls.LocalCall); var plan = new TextPlan(4); new TextTaxation() .CalculatePrice(call, plan) .Value.Should().Be(8); }
public void LongDistance() { var call = new TextCall(2, TestCalls.LongDiscanceCall); var plan =new TextPlan(4); new TextTaxation() .CalculatePrice(call, plan) .Value.Should().Be(12); }
public Price CalculatePrice(PriceCalculationViewModel priceCalculation) { var voiceCall = new VoiceCall(new TimeSpan(0, 0, priceCalculation.Units), _standardHardcodedCall); var textCall = new TextCall(priceCalculation.Units, _standardHardcodedCall); var dataCall = new DataCall(priceCalculation.Units.KByte(), _standardHardcodedCall); switch (priceCalculation.PlanType) { case PlanType.VoicePlan1: return _voiceTaxation.CalculatePrice(voiceCall, StandardPlans.VoicePlan1); case PlanType.VoicePlan2: return _voiceTaxation.CalculatePrice(voiceCall, StandardPlans.VoicePlan2); case PlanType.DataPlan1: return _dataTaxation.CalculatePrice(dataCall, StandardPlans.DataPlan1); case PlanType.DataPlan2: return _dataTaxation.CalculatePrice(dataCall, StandardPlans.DataPlan2); case PlanType.TextPlan1: return _textTaxation.CalculatePrice(textCall, StandardPlans.TextPlan1); case PlanType.TextPlan2: return _textTaxation.CalculatePrice(textCall, StandardPlans.TextPlan2); default: throw new ArgumentOutOfRangeException(); } }