public void GetTotalCostByDifferentBandsTest() { var customerId = Guid.NewGuid(); _moqAccountDetails.Setup(x => x.NumberOfTextMessagesSentInMonth(customerId, 1, 1)).Returns(700); _moqAccountDetails.Setup(x => x.GetAccountPriceBands(customerId)).Returns(new List <PriceBand> { new PriceBand { QtyFrom = 1, QtyTo = 200, PricePerTextMessage = 0.10m }, new PriceBand { QtyFrom = 201, QtyTo = 500, PricePerTextMessage = 0.08m }, new PriceBand { QtyFrom = 501, QtyTo = 1000, PricePerTextMessage = 0.06m }, new PriceBand { QtyFrom = 1001, PricePerTextMessage = 0.03m } }); var costCalculator = new TotalCostCalculator(_moqAccountDetails.Object); var totalCost = costCalculator.CalculateCost(customerId, 1, 1); Assert.Equal(56.00m, totalCost); }
static void Main(string[] args) { var calculator = new TotalCostCalculator(100); var totalCost = calculator.CalculateTotalCost(price => price * 0.23m, ConsoleNotification); Console.WriteLine($"Total cost for $50 after tax for Poland is: ${totalCost}"); }
public TotalCostCalculatorTests() { _accountDetails = A.Fake <IAccountDetails>(); A.CallTo(() => _accountDetails.GetAccountPriceBands(_customerAccount)) .Returns(GetAccountPriceBands()); _calculator = new TotalCostCalculator(_accountDetails); }
public DeliveryServiceModel GetOrderCost(DeliveryServiceModel deliveryServiceModel) { deliveryServiceModel.TotalCost = TotalCostCalculator.CalculateTotalCost(deliveryServiceModel); return(this._adapter.Save(deliveryServiceModel)); }