public void BeginCheckout(string licensePlate) { if (checkedInCars.ContainsKey(licensePlate)) { var checkinTime = checkedInCars[licensePlate]; var checkoutTime = clock.Now(); var time = checkoutTime - checkinTime; debt.Add(licensePlate, priceStrategy.CalcalatePrice(time)); //var payedTime = time - freeTime; //if (payedTime < TimeSpan.Zero) //{ // debt.Add(licensePlate, 0); //} //else //{ // var spans = (decimal)(payedTime / span); // var spansBegun = Math.Ceiling(spans); // debt.Add(licensePlate, spansBegun * price); //} checkedInCars.Remove(licensePlate); } else { Error("Car not checkedIn"); } }
public void PriceFor6minutes() { Assert.Equal(15, strategy.CalcalatePrice(TimeSpan.FromMinutes(6))); }