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(); } }
private static void AssertLocalCall(long kBytesUsed, long billingFrequencyBytes, long expectedPrice) { var call = new DataCall(kBytesUsed, TestCalls.LocalCall); var plan = new DataPlan(20, billingFrequencyBytes); new DataTaxation().CalculatePrice(call, plan).Value.Should().Be(expectedPrice); }
public void LongDistanceCall() { var call = new DataCall(2.Megabyte(), TestCalls.LongDiscanceCall); var plan = new DataPlan(20, 1.Megabyte()); new DataTaxation().CalculatePrice(call, plan).Value.Should().Be(60); }