public async Task Handle(QuoteRequestedEvent notification) { var quote = await _quoteRepository.FindById(notification.QuoteId); var modifier = _quotingCalculator.SelectPriceModifierRuleFor(quote.Customer); var basePriceRule = _quotingCalculator.SelectBasePriceRuleFor(quote.Vehicle); quote.CalculatePriceWithRules(await basePriceRule, await modifier); _quoteRepository.Update(quote); await _unitOfWork.SaveChangesAsync(); }
public void SelectBasePriceRuleFor_ShouldReturnConfiguredPrice_WhenThereIsARuleAppliableToTheVehicle(Vehicle vehicle, IQuoteRulesCalculatorService calculator, BasePriceRule basePrice) { BasePriceRule resultRule = calculator.SelectBasePriceRuleFor(vehicle).Result; AssertValueObject(basePrice, resultRule); }