Beispiel #1
0
        public ComponentReplacer(Computer computer, Component component, IComponentReadOnlyRepository componentRepository, IFactoryCompatibility compatibilities, IFactoryEnough enoughs)
        {
            this.compatibilities = compatibilities;
            this.enoughs         = enoughs;
            this.computer        = computer;
            this.component       = component;
            components           = componentRepository.All.Where(c => c.TypePart == component.TypePart)
                                   .Where(c => c.IsEnough(enoughs[Enough.Level], GetLevelToReplace(component)))
                                   .Where(c => c.Id != component.Id)
                                   .OrderBy(c => c.Price);

            replaces = new Dictionary <TypePart, Func <Component> >
            {
                { TypePart.cpu, ReplaceCpu },
                { TypePart.mother, ReplaceMother },
                { TypePart.fan, ReplaceFan },
                { TypePart.ram, ReplaceRam },
                { TypePart.gpu, ReplaceGpu },
                { TypePart.hdd, ReplaceCapacity },
                { TypePart.ssd, ReplaceCapacity },
                { TypePart.tower, ReplaceTower },
                { TypePart.psu, ReplaceCapacity },
                { TypePart.accesory, ReplaceAccesory }
            };
        }
Beispiel #2
0
 public BuilderComputer(IStrategyOrderBy orderBy, IFactoryCompatibility factoryCompatibility, IFactoryEnough factoryEnough, IComponentReadOnlyRepository componentRepo, ICostsReadOnlyRepository costRepo)
 {
     this.orderBy = orderBy;
     this.factoryCompatibility = factoryCompatibility;
     this.factoryEnough        = factoryEnough;
     repository = componentRepo;
     buildCost  = costRepo.BuildCost;
     pricePerfomanceMultiplier = costRepo.PricePerfomanceMultiplier;
 }
Beispiel #3
0
 public RegisterBuildError(IComponentReadOnlyRepository componenRepository, IFactoryCompatibility compatibilities, IFactoryEnough enoughs, IErrorBuildingWriteOnlyRepository errorRepository, IErrorBuildingWithReplaceWriteOnlyRepository errorReplaceRepository, IComputerReadOnlyRepository computerRepository)
 {
     this.componenRepository     = componenRepository;
     this.compatibilities        = compatibilities;
     this.enoughs                = enoughs;
     this.errorRepository        = errorRepository;
     this.errorReplaceRepository = errorReplaceRepository;
     this.computerRepository     = computerRepository;
 }