public async void CalculeContratosChamandoInicioDeFormaIndevida() { var quantidadeCalls = 500; var mockCalculoRepository = Substitute.For <ICalculoRepository>(); mockCalculoRepository .InsiraValoresCalculados(Arg.Any <ComponentesCalculados>()) .Returns(Task.CompletedTask); var mockContratoRepository = Substitute.For <IContratoRepository>(); mockContratoRepository .ObterContratosVigentes(Arg.Any <DateTime>()) .Returns(CenarioContrato.CrieCenarioValido(quantidadeCalls)); var mockRabbtimq = Substitute.For <IRabbitMQBus>(); var mockUser = Substitute.For <IUser>(); var builder = new CalculoBuilder(DateTime.Now, EnumFolhaDePagamento.Mensal, mockCalculoRepository, Substitute.For <IFeedbackExecucaoCalculoServiceDomain>()); var ex = await Assert.ThrowsAsync <ArgumentException>(() => builder.CalculeContratos()); }
public IActionResult Post(CalculoViewModel calculoViewModel) { var calculo = new CalculoBuilder(calculoViewModel.Referencia, EnumFolhaDePagamento.Mensal, _calculoRepository, _feedbackExecucaoCalculoServiceDomain); calculo.InicieCalculo(_contratoRepository); _ = calculo.CalculeContratos(); return(Ok(calculo.IdExecucao)); }
public async System.Threading.Tasks.Task CalculeContratosParallelForAsync() => await calculo.CalculeContratos();