Пример #1
0
        private List <PCComponent> CreateComponents(List <ComponentInterface> slotsToInsert,
                                                    List <ComponentCharacteristic> characteristics)
        {
            var componentsToInsert = new List <PCComponent>();

            for (var i = 0; i < 5; i++)
            {
                var newComponent = new PCComponent(NamesGenerator.ComponentName(i), ComponentType.PowerSupply);
                newComponent
                .WithAveragePrice(100 * (i + 1))
                .WithPlugSlot(slotsToInsert.RandomElement())
                .WithContainedSlot(slotsToInsert.RandomElement())
                .WithContainedSlot(slotsToInsert.RandomElementExcept(newComponent.ContainedSlots.ToList()));
                componentsToInsert.Add(newComponent);
                AddCharacteristicsToComponent(characteristics, newComponent);
            }
            CreateRandomLinks(componentsToInsert);
            return(componentsToInsert);
        }