public void Run(ICrudDataHandleStressable <T> crud, ISelectionStressable <T> select) { var settings = new TesteComUmMilhao(); var dadosParaBusca = new StressTestDataCollection <T>(); var selects = new List <SelectStressRunner <T, TKParcela, TKCobranca> >(); using (new Cronometro("Executando {0} x {1}", settings.TotalCiclos, settings)) { for (var i = 0; i < settings.TotalCiclos; i++) { var stressData = new CrudStressData <T>(settings, new ContratoGeneration <T, TKParcela, TKCobranca>(new DataGenerationSettings())); var percentualParaBusca = stressData.InsertsDumb.TakeRandomWithoutRemove(settings.SelectsInterval); dadosParaBusca.AddRange(percentualParaBusca); var crudRunner = new CrudStressRunner <T>(crud, stressData); using (new Cronometro("Executando inserts")) crudRunner.Run(); var selectRunner = new SelectStressRunner <T, TKParcela, TKCobranca>(select, dadosParaBusca); selectRunner.Run(); selects.Add((selectRunner)); } foreach (var selectStressRunner in selects) { selectStressRunner.WaitAll(); } } }
public SelectStressRunner(ISelectionStressable <T> select, StressTestDataCollection <T> data) { _select = select; _contratos = data; _contratosPeriodo = new StressTestDataCollection <Periodo>(GetIntervalos(_contratos)); }