public List <TEntity> GenerateAssembly(ePerson personType, int countryRating, int?competitionRation = null, int?teamRating = null)
        {
            var totalRating = teamRating != null && competitionRation != null
                ? countryRating * (int)competitionRation * (int)teamRating
                : countryRating *RandomUtil.GetRandomInt(2, 5) * RandomUtil.GetRandomInt(2, 5);

            var assembly = BuildAssembly();

            CompleteAssembly(assembly);
            return(CreateAllPersonsInAssembly(assembly, totalRating, personType));
        }
        protected internal static List <TEntity> CreateAllPersonsInAssembly(Dictionary <int, int> assembly, int totalRating, ePerson personType)
        {
            var persons = new List <TEntity>();

            foreach (var person in assembly)
            {
                for (int i = 0; i < person.Value; i++)
                {
                    persons.Add(PersonStrategyFactory <TEntity> .CreatePerson(personType, totalRating, person.Key));
                }
            }

            return(persons);
        }
Exemplo n.º 3
0
 public static List <TEntity> GenerateAssembly(ePerson personType, int countryRating,
                                               int?competitionRation = null, int?teamRating = null)
 {
     return(((IAssemblyGenerator <TEntity>)AssemblyDictionary[personType]).GenerateAssembly(personType, countryRating, competitionRation, teamRating));
 }
 public static void SetPersonAttributes(ePerson personType, TEntity person)
 {
     ((IPersonGeneratorStrategy <TEntity>)PersonDictionary[personType]).SetPersonAttributes(person);
 }
 public static void SetPersonalInformation(ePerson personType, TEntity person)
 {
     ((IPersonGeneratorStrategy <TEntity>)PersonDictionary[personType]).SetPersonalInformation(person);
 }
 public static TEntity CreatePerson(ePerson personType, int totalRating, int mainFunction)
 {
     return(((IPersonGeneratorStrategy <TEntity>)PersonDictionary[personType]).CreatePerson(totalRating, mainFunction));
 }