private decimal FullCostOfBand(PriceBand band) { var totalMessagesInBand = band.QtyTo.Value - (band.QtyFrom - 1); return(totalMessagesInBand * band.PricePerTextMessage); }
private decimal PartialCostOfBand(PriceBand band, int totalMonthlyMessages) { var totalMessagesSentInBand = totalMonthlyMessages - (band.QtyFrom - 1); return(totalMessagesSentInBand * band.PricePerTextMessage); }
private decimal CalculateCostOfBand(PriceBand band, int totalMonthlyMessages) { return(band.QtyTo.HasValue && totalMonthlyMessages > band.QtyTo ? FullCostOfBand(band) : PartialCostOfBand(band, totalMonthlyMessages)); }