private void UpdatePreliminaryPrice(UpdatePreliminaryPriceMessage message) { var currentDayPrice = _trangselskattCalculator.CalculateDayPrice(message.DateToUpdate, _vehicle, _passageTimes.AsReadOnly()); _daySumMap.AddOrSet(message.DateToUpdate.Date, currentDayPrice); Log.Info($"[{_vehicle.RegistrationNumber} - {message.DateToUpdate}] New day total: {currentDayPrice}"); }
public void Non_Other_Vehicle_Types_Should_Not_Pay_Tax() { //Setup _dateTimeProvider.Setup(x => x.Now).Returns(new DateTime(2020, 1, 2, 8, 30, 0)); var redDayList = new List <DateTime> { new DateTime(2020, 1, 1) }; _redDayProviderMock.Setup(x => x.RedDays).Returns(redDayList); var nonOtherVehicles = new List <Vehicle>(); for (var i = 1; i <= 5; i++) { nonOtherVehicles.Add(new Vehicle("ABC101", (VehicleType)i)); } var history = new List <DateTime> { new DateTime(2020, 1, 2, 7, 0, 0), //group 1 - 22 new DateTime(2020, 1, 2, 7, 59, 0), //group 1 - 0 new DateTime(2020, 1, 2, 8, 29, 0), //group 2 - 16 new DateTime(2020, 1, 2, 8, 59, 0), //group 2 - 0 new DateTime(2020, 1, 2, 9, 19, 0), //group 2 - 0 new DateTime(2020, 1, 2, 9, 30, 0), //group 3 - 9 }.AsReadOnly(); //Act var prices = new List <int>(); foreach (var nonOtherVehicle in nonOtherVehicles) { var totalPrice = _trangselskattCalculator.CalculateDayPrice(history[0], nonOtherVehicle, history); prices.Add(totalPrice); } //Assert for (var i = 0; i < prices.Count; i++) { var price = prices[i]; Assert.AreEqual(0, price, $"Error in index {i}"); } }