Exemplo n.º 1
0
 private IGameOfLife _createSubjectUnderTest(int rows, int cols, IGameEventEmitter eventEmitter = null,
                                             IGenerationService genService = null)
 {
     eventEmitter = eventEmitter ?? new GameEventEmitterBuilder().Build();
     genService   = genService ?? new GenerationServiceBuilder().Build();
     return(new GameOfLife(eventEmitter, genService, rowCount: rows, columnCount: cols));
 }
Exemplo n.º 2
0
        public ConsoleRunner(
            [NotNull] IGenerationService generationService,
            [NotNull] IConsoleWriter consoleWriter,
            [NotNull] IHelpWriter helpWriter,
            [NotNull] IResultWriter resultWriter)
        {
            if (generationService == null)
            {
                throw new ArgumentNullException(nameof(generationService));
            }
            if (consoleWriter == null)
            {
                throw new ArgumentNullException(nameof(consoleWriter));
            }
            if (resultWriter == null)
            {
                throw new ArgumentNullException(nameof(resultWriter));
            }
            if (helpWriter == null)
            {
                throw new ArgumentNullException(nameof(helpWriter));
            }

            _generationService = generationService;
            _consoleWriter     = consoleWriter;
            _helpWriter        = helpWriter;
            _resultWriter      = resultWriter;
        }
Exemplo n.º 3
0
        public GameOfLife(IGameEventEmitter eventEmitter, IGenerationService genService, int rowCount, int columnCount)
        {
            _eventEmitter = eventEmitter;
            _genService   = genService;

            this.RowCount = rowCount;
            this.ColCount = columnCount;
        }
Exemplo n.º 4
0
 public TransactionService(IBanksCardRepository banksCardRepository,
                           IUserService userService,
                           IBankAccountRepository bankAccountRepository,
                           ICurrencyService currencyService,
                           IGenerationService generationService,
                           ITransactionBankRepository transactionBankRepository)
 {
     _banksCardRepository       = banksCardRepository;
     _userService               = userService;
     _bankAccountRepository     = bankAccountRepository;
     _currencyService           = currencyService;
     _generationService         = generationService;
     _transactionBankRepository = transactionBankRepository;
 }
Exemplo n.º 5
0
        public async Task <List <DTO.DropdownPokemon> > GetPokemonsByGenerationId(int id,
                                                                                  [FromServices] IGenerationService service, [FromServices] IMemoryCache cache)
        {
            var pokemons = cache.Get <List <DTO.DropdownPokemon> >($"GetPokemonsByGenerationId{id}");

            if (pokemons != null)
            {
                return(pokemons);
            }

            pokemons = await service.GetPokemonsByGeneration(id);

            cache.Set($"GetPokemonsByGenerationId{id}", pokemons);

            return(pokemons);
        }
Exemplo n.º 6
0
 public AccountPresentation(IBankAccountRepository bankAccountRepository,
                            IMapper mapper,
                            IWebHostEnvironment hostEnvironment,
                            UserService userService,
                            IGenerationService generationService,
                            ICurrencyService currencyService,
                            ITransactionService transactionService)
 {
     _bankAccountRepository = bankAccountRepository;
     _mapper             = mapper;
     _hostEnvironment    = hostEnvironment;
     _userService        = userService;
     _generationService  = generationService;
     _currencyService    = currencyService;
     _transactionService = transactionService;
 }
Exemplo n.º 7
0
    public double CalcOwnedUpgrades(Upgrade up)
    {
        if (up.UpgradeType == UpgradeType.Profit)
        {
            IGenerationService generationService = GameServices.Instance.GenerationService;

            if (generationService.Generators.Contains(up.GeneratorIdToUpgrade))
            {
                return(generationService.Generators.GetGeneratorInfo(up.GeneratorIdToUpgrade).ProfitBoosts.Value); //GetProfitValue(up.GeneratorIdToUpgrade);
            }
        }

        if (up.UpgradeType == UpgradeType.Time)
        {
            if (GameServices.Instance.GenerationService.Generators.Contains(up.GeneratorIdToUpgrade))
            {
                return(GameServices.Instance.GenerationService.Generators.GetGeneratorInfo(up.GeneratorIdToUpgrade).TimeBoosts.Value); //GetTimeValue(up.GeneratorIdToUpgrade);
            }
        }

        return(0);
    }
Exemplo n.º 8
0
 public async Task <Models.Generation> Get(int id, [FromServices] IGenerationService service)
 {
     return(await service.Get(id));
 }
Exemplo n.º 9
0
 public async Task <List <DTO.Generation> > GetAll([FromServices] IGenerationService service)
 {
     return(await service.GetAll());
 }
Exemplo n.º 10
0
 public GameFactory(IGenerationService genService)
 {
     _genService = genService;
 }
 public GenerationController(IGenerationService generationService)
 {
     _generationService = generationService;
 }