public RecalculateArrangementRequestCommandHandler( IApplicationRepository applicationRepository, IArrangementRequestRepository arrangementRequestRepository, CalculatorProvider calculatorProvider ) { this._applicationRepository = applicationRepository; this._arrangementRequestRepository = arrangementRequestRepository; _calculatorProvider = calculatorProvider ?? throw new ArgumentNullException(nameof(calculatorProvider)); }
public InitiateCalculateOfferCommandHandler(ILogger <InitiateCalculateOfferCommand> logger, IPriceCalculationService priceCalculation, ArrangementRequestFactory requestFactory, CalculatorProvider calculatorProvider, IConfigurationService configurationService, IAuditClient auditClient) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _priceCalculation = priceCalculation ?? throw new ArgumentNullException(nameof(priceCalculation)); _requestFactory = requestFactory ?? throw new ArgumentNullException(nameof(requestFactory)); _calculatorProvider = calculatorProvider ?? throw new ArgumentNullException(nameof(calculatorProvider)); _configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService)); _auditClient = auditClient ?? throw new ArgumentNullException(nameof(auditClient));; }
static void Main(string[] args) { ICalculator strategy; CalculatorProvider provider = new CalculatorProvider(); decimal result = 0; int chose = -1; Console.WriteLine("Escolha uma operação: "); Console.WriteLine("1: Somar"); Console.WriteLine("2: Subtrair"); Console.WriteLine("3: Multiplicar"); Console.WriteLine("4: Dividir"); while (chose != 0) { Console.Write("Escolha: "); chose = Convert.ToInt32(Console.ReadLine()); switch (chose) { case 1: strategy = provider.GetOperation("Add"); break; case 2: strategy = provider.GetOperation("Subtract"); break; case 3: strategy = provider.GetOperation("Multiply"); break; case 4: strategy = provider.GetOperation("Divide"); break; default: strategy = null; break; } result = strategy.Execute(2, 2); if (strategy != null) { Console.WriteLine($"{strategy.GetType().Name}: {result}"); } Console.WriteLine(""); } Console.ReadKey(); }
public ArrangementRequestFactory(IConfigurationService configurationService, IProductService productService, IArrangementService arrangementService, ICampaignService campaignService, ILogger <ArrangementRequestFactory> logger, OfferPriceCalculation priceCalculator, CalculatorProvider calculatorProvider, IProductSnapshotRepository productSnapshotRepository) { _configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService)); _productService = productService ?? throw new ArgumentNullException(nameof(productService)); _arrangementService = arrangementService ?? throw new ArgumentNullException(nameof(arrangementService)); _campaignService = campaignService ?? throw new ArgumentNullException(nameof(campaignService)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _calculatorProvider = calculatorProvider ?? throw new ArgumentNullException(nameof(calculatorProvider)); _priceCalculator = priceCalculator ?? throw new ArgumentNullException(nameof(priceCalculator)); _productSnapshotRepository = productSnapshotRepository ?? throw new ArgumentNullException(nameof(productSnapshotRepository)); }
public UpdateArrangementRequestCommandHandler(IMediator mediator, IArrangementRequestRepository arrangementRequestRepository, IConfigurationService configurationService, OfferPriceCalculation priceCalculator, IApplicationRepository applicationRepository, ILogger <UpdateArrangementRequestCommand> logger, CalculatorProvider calculatorProvider, IAuditClient auditClient, MessageEventFactory messageEventFactory, IEventBus eventBus) { this._arrangementRequestRepository = arrangementRequestRepository; this._applicationRepository = applicationRepository; _mediator = mediator ?? throw new ArgumentNullException(nameof(mediator)); this.priceCalculator = priceCalculator; this._configurationService = configurationService ?? throw new ArgumentNullException(nameof(configurationService)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _calculatorProvider = calculatorProvider ?? throw new ArgumentNullException(nameof(calculatorProvider)); _auditClient = auditClient ?? throw new ArgumentNullException(nameof(auditClient)); _messageEventFactory = messageEventFactory ?? throw new ArgumentNullException(nameof(messageEventFactory)); _eventBus = eventBus ?? throw new ArgumentNullException(nameof(eventBus)); }
public void TestInit() { _calculatorProvider = new CalculatorProvider(); }