public SimulationCaseResult Run(T simulationCase, IEnumerable <U> persons) { var resultDict = new Dictionary <Guid, PersonCaseResult>(); var personDict = persons.ToDictionary(x => x.Id); int i = 0; bool trigger = true; while (trigger) { var personBatch = persons.Skip(i * CHUNK_SIZE).Take(CHUNK_SIZE); if (personBatch.Count() == 0) { break; } i++; var nextSet = _executor.Execute(simulationCase, personBatch); foreach (var res in nextSet) { var nextResult = new PersonCaseResult() { Person = personDict[res.Key], Amount = res.Value }; resultDict.Add(res.Key, nextResult); } } return(new SimulationCaseResult() { ResultSet = resultDict }); }
public SimulationCaseResult Run(MaternityBenefitSimulationCase simulationCase, IEnumerable <MaternityBenefitPerson> persons) { var result = new SimulationCaseResult(); var personDict = persons.ToDictionary(x => x.Id); foreach (var person in persons) { var amount = _executor.Execute(simulationCase, person); var nextResult = new PersonCaseResult() { Person = personDict[person.Id], Amount = amount }; result.ResultSet.Add(person.Id, nextResult); } return(result); }
private SimulationCaseResult GenerateCaseResult(Guid personId, decimal amount) { var pcr1 = new PersonCaseResult() { Person = A.Fake <IPerson>(), Amount = amount }; var dict = new Dictionary <Guid, PersonCaseResult>() { { personId, pcr1 } }; return(new SimulationCaseResult() { ResultSet = dict }); }
private SimulationCaseResult GenerateCaseResult(Guid personId, decimal amount) { var pcr1 = new PersonCaseResult() { Person = PersonBuilder.Generate(personId), Amount = amount }; var dict = new Dictionary <Guid, PersonCaseResult>() { { pcr1.Person.Id, pcr1 } }; return(new SimulationCaseResult() { ResultSet = dict }); }