public PokemonController(ILogger <PokemonController> logger, IPokemonService pokemonRepo,
                          IShakespeareTranslationService translationService)
 {
     _logger             = logger;
     _pokemonRepo        = pokemonRepo;
     _translationService = translationService;
 }
        public MainViewModel(ICustomVision customVision, IPokemonService pokemonService) : base("Pokédex")
        {
            VerificarPokemonCommand = new Command(ExecuteVerificarPokemonCommand);

            _CustomVision   = customVision;
            _PokemonService = pokemonService;
        }
 public AbilityViewModel(INavigationService navigationService, IPokemonService pokemonService, IStaticDataService staticDataService) : base(staticDataService)
 {
     _tokenSource = new CancellationTokenSource();
     _navigationService = navigationService;
     _pokemonService = pokemonService;
     _cachedAbilityId = 1;
 }
Example #4
0
        public async void Valid_PokemonName_ReturnSuccess()
        {
            //Arrange
            _mockClient.Setup(x => x.Get(It.IsAny <string>(), It.IsAny <PokemonQueryParams>())).ReturnsAsync(new PokemonSpecies
            {
                Name = TestData._mockName,
                FlavorTextEntries = new List <PokemonSpeciesFlavorTexts> {
                    new PokemonSpeciesFlavorTexts {
                        FlavorText = TestData._mockDetails,
                        Language   = new NamedApiResource <Language> {
                            Name = "en"
                        }
                    }
                }
            });
            _pokemonService = new PokemonService(_mockLogger.Object, _mockClient.Object, _mockOptions.Object);

            //Act
            var output = await _pokemonService.GetPokemonDetailsAsync(TestData._mockName);

            //Assert
            Assert.Equal(TestData._mockName, output.Name);
            Assert.Equal(TestData._mockDetails, output.Description);
            Assert.Null(output.Error);
        }
Example #5
0
        public MainViewModel()
        {
            Pokemons        = new ObservableCollection <Pokemon>();
            _pokemonService = new PokemonService(); // Aqui deveria ter uma Injeção de Dependencia

            LoadAsync();
        }
Example #6
0
 public PokemonApi
     (IPokemonService pokemonService,
     ILogger <PokemonApi> logger)
 {
     _pokemonService = pokemonService;
     _logger         = logger;
 }
Example #7
0
 public PokemonModule(ISpawnpointRepository spawnpointRepository, ISightingRepository sightingRepository, IPokemonService pokemonService, IConfigurationService configurationService, IEmojiService emojiService, ILocalizationService localizationService)
     : base(configurationService, emojiService, localizationService)
 {
     SpawnpointRepository = spawnpointRepository;
     SightingRepository   = sightingRepository;
     _pokemonService      = pokemonService;
 }
Example #8
0
 public CatchService(IPokemonService pokemonService, IMapper mapper, IRepository <Pokemon> pokeRepository, IChanceGenerator chanceGenerator)
 {
     _pokemonService  = pokemonService;
     _mapper          = mapper;
     _pokeRepository  = pokeRepository;
     _chanceGenerator = chanceGenerator;
 }
 public AbilityViewModel(INavigationService navigationService, IPokemonService pokemonService, IStaticDataService staticDataService) : base(staticDataService)
 {
     _tokenSource       = new CancellationTokenSource();
     _navigationService = navigationService;
     _pokemonService    = pokemonService;
     _cachedAbilityId   = 1;
 }
Example #10
0
 public ScenarioPokemonService(ModInfo mod, IPokemonService pokemonService) : base(null, 0, 10)
 {
     for (int i = _minId; i <= _maxId; i++)
     {
         _cache.Add(new ChildScenarioPokemonService(Path.Combine(mod.FolderPath, Constants.ScenarioPokemonPathFromId(i)), pokemonService));
     }
 }
Example #11
0
 public VMDetailPokemon(IMvxNavigationService navigationService, IPokemonService pokemonService, IRestClient restClient)
 {
     _navigationService = navigationService;
     _pokemonService    = pokemonService;
     _restClient        = restClient;
     PokemonsTypes      = new MvxObservableCollection <PokemonGeneration>();
 }
Example #12
0
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            _pokemonService = context.HttpContext.RequestServices.GetService <IPokemonService>();

            if (context.ActionArguments.Values.FirstOrDefault() is PokemonForCreationDto)
            {
                var dto = new PokemonForCreationDto();
                dto = context.ActionArguments.Values.Cast <PokemonForCreationDto>().FirstOrDefault();

                if (dto != null)
                {
                    if (string.IsNullOrEmpty(dto.ImageUrl))
                    {
                        context.ModelState.AddModelError(nameof(dto.ImageUrl), "Image is required.");
                    }

                    if (!_pokemonService.NameIsUnique(dto.Name))
                    {
                        context.ModelState.AddModelError(nameof(dto.Name), "Name is not unique.");
                    }
                }
            }

            if (!context.ModelState.IsValid)
            {
                context.Result = new ValidationFailedResult(context.ModelState);
            }
        }
Example #13
0
        public PokemonController(ILogger <PokemonController> logger, IPokemonService serviceTypes)
        {
            _pokemonService = serviceTypes;

            _logger = logger;
            _logger.LogInformation("ctor");
        }
        public MainViewModel()
        {
            Pokemons        = new ObservableCollection <Pokemon>();
            _pokemonService = new PokemonService();
            RefreshCommand  = new Command(RefreshExecute);

            LoadAsync();
        }
 public RaidService(IRaidRepository raidRepository, IGymService gymService, IPokemonService pokemonService, IRaidbossService raidbossService, ILocalizationService localizationService)
 {
     RaidRepository      = raidRepository;
     LocalizationService = localizationService;
     GymService          = gymService;
     PokemonService      = pokemonService;
     RaidbossService     = raidbossService;
 }
Example #16
0
 public PokemonController(IPokemonService pokemonService, IMapper <Pokemon, PokemonDto> pokemonMapper,
                          ITranslationService translationService, IMapper <Pokemon, TranslatedPokemonDto> translatedPokemonMapper)
 {
     _pokemonService          = pokemonService;
     _pokemonMapper           = pokemonMapper;
     _translationService      = translationService;
     _translatedPokemonMapper = translatedPokemonMapper;
 }
Example #17
0
 public OcrService(IConfigurationService configurationService, IGymService gymService, IPokemonService pokemonService, IRaidService raidService, ILocalizationService localizationService)
 {
     ConfigurationService = configurationService;
     GymService           = gymService;
     PokemonService       = pokemonService;
     RaidService          = raidService;
     LocalizationService  = localizationService;
 }
Example #18
0
 public ScenarioWarriorGridViewModel(IIdToNameService idToNameService, IScenarioPokemonService scenarioPokemonService, IPokemonService pokemonService, IAbilityService abilityService)
 {
     _scenarioPokemonService = scenarioPokemonService;
     _pokemonService         = pokemonService;
     _abilityService         = abilityService;
     WarriorItems            = idToNameService.GetComboBoxItemsExceptDefault <IBaseWarriorService>();
     KingdomItems            = idToNameService.GetComboBoxItemsPlusDefault <IKingdomService>();
 }
Example #19
0
        public ListagemPokemonsPageViewModel(IPokemonService pokemonService, INavigationService navigationService, IPageDialogService pageDialogService)
        {
            _pokemonService    = pokemonService;
            _navigationService = navigationService;
            _pageDialogService = pageDialogService;

            Pokemons = _pokemonService.SelectAll();
        }
 public VMFilterTypePokemon(IMvxNavigationService navigationService, IPokemonService pokemonService, IRestClient restClient)
 {
     _navigationService         = navigationService;
     _pokemonService            = pokemonService;
     _restClient                = restClient;
     ClosePageCommand           = new MvxAsyncCommand(ClosePage);
     PokemonsTypes              = new MvxObservableCollection <PokemonGeneration>();
     PokemonTypeSelectedCommand = new MvxAsyncCommand <PokemonGeneration>(PokemonTypeSelected);
 }
Example #21
0
 public MainViewModel(ILogger <MainViewModel> logger)
 {
     IsNotConnected = false;
     Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;
     Title           = "Poke Xamarin";
     Pokemons        = new ObservableCollection <Pokemon>();
     _PokemonService = App.ServiceProvider.GetService <IPokemonService>();
     logger.LogCritical("Acessando o Aplicativo");
 }
        public PokemonApiTests()
        {
            _mockRepository = new MockRepository(MockBehavior.Strict);
            _dataProvider   = _mockRepository.Create <IDataProvider>();
            _mapper         = _mockRepository.Create <IMapper>();
            _logger         = new Mock <ILogger <PokemonService> >();

            _subject = new PokemonService(_dataProvider.Object,
                                          _logger.Object, _mapper.Object);
        }
Example #23
0
    /// <summary>
    /// Load all the required stuff into memory
    /// </summary>
    private void Init(IServiceGetter services)
    {
        _moveService            = services.Get <IMoveService>();
        _moveRangeService       = services.Get <IMoveRangeService>();
        _pokemonService         = services.Get <IPokemonService>();
        _scenarioPokemonService = services.Get <IScenarioPokemonService>();
        _scenarioWarriorService = services.Get <IScenarioWarriorService>();

        _moveRangeService = services.Get <IMoveRangeService>();
    }
Example #24
0
 public QuizFlow
     (IHttpContextAccessor httpContextAccessor,
     IRandomizer randomizer,
     IPokemonService pokemonService,
     IQuizCalculations quizCalculations)
 {
     _session          = httpContextAccessor.HttpContext.Session;
     _randomizer       = randomizer;
     _pokemonService   = pokemonService;
     _quizCalculations = quizCalculations;
 }
Example #25
0
        public QuizController
            (IPokemonService pokemonService,
            IRandomizer randomizer,
            IHttpContextAccessor httpContextAccessor,
            IQuizCalculations quizCalculations,
            IQuizFlow quizFlow,
            IPokemonUserSQLService pokemonUserSQLService)

        {
            _pokemonService        = pokemonService;
            _randomizer            = randomizer;
            _session               = httpContextAccessor.HttpContext.Session;
            _quizCalulations       = quizCalculations;
            _quizFlow              = quizFlow;
            _pokemonUserSQLService = pokemonUserSQLService;
        }
Example #26
0
        public async void Valid_PokemonName_ReturnsErrorNullSpecies()
        {
            //Arrange
            _mockClient.Setup(x => x.Get(It.IsAny <string>(), It.IsAny <PokemonQueryParams>())).ReturnsAsync(new PokemonSpecies
            {
                Name = TestData._mockName,
                FlavorTextEntries = null
            });
            _pokemonService = new PokemonService(_mockLogger.Object, _mockClient.Object, _mockOptions.Object);

            //Act
            var output = await _pokemonService.GetPokemonDetailsAsync(TestData._mockName);

            //Assert
            Assert.NotNull(output.Error);
            Assert.Equal(500, output.Error.Code);
        }
        public MapPageViewModel(INavigationService navigationService, IPokemonService pokemonService)
            : base(navigationService)
        {
            Title              = "Mapa de Pokemons";
            _pokemonService    = pokemonService;
            _navigationService = navigationService;

            Map       = new CustomMap();
            CustomMap = new CustomMap
            {
                MapType       = MapType.Street,
                WidthRequest  = App.ScreenWidth,
                HeightRequest = App.ScreenHeight
            };
            //var pins = new List<CustomPin>();
            _pokemon = new Poke();
        }
Example #28
0
        public PokemonViewModel(IStaticDataService staticDataService, IPokemonService pokemonService, INavigationService navigationService)
        {
            _tokenSource       = new CancellationTokenSource();
            _staticDataService = staticDataService;
            _pokemonService    = pokemonService;
            _navigationService = navigationService;

            var    settings = ApplicationData.Current.LocalSettings;
            object lang     = settings.Values["displayLanguage"];

            if (lang != null)
            {
                _currentLanguage = Convert.ToInt32(lang);
            }
            else
            {
                _currentLanguage = 6;
            }

            ChangeLanguage(new Language {
                Id = _currentLanguage
            });
            Messenger.Default.Register <Language>(this, (language) => ChangeLanguage(language));

            if (IsInDesignMode)
            {
                Versions = NotifyTaskCompletionCollection <GameVersion> .Create(LoadVersionsAsync(_currentLanguage));

                SpeciesList = NotifyTaskCompletionCollection <SpeciesName> .Create(LoadSpeciesAsync(null, _currentLanguage));

                Forms = NotifyTaskCompletionCollection <PokemonForm> .Create(LoadFormsAsync(new SpeciesName {
                    Id = 1
                }, null, _currentLanguage));

                CurrentForm       = NotifyTaskCompletion.Create(LoadFormAsync(1, null, _currentLanguage));
                CurrentMoveSet    = NotifyTaskCompletion.Create(LoadMoveSetAsync(6, null, _currentLanguage));
                CurrentStats      = NotifyTaskCompletion.Create(LoadStatsAsync(6, null, _currentLanguage));
                CurrentEvolutions = NotifyTaskCompletion.Create(LoadEvolutionsAsync(6, null, _currentLanguage));
                CurrentLocations  = NotifyTaskCompletion.Create(LoadLocationsAsync(6, null, _currentLanguage));
            }
        }
Example #29
0
 public VMTypePokemon(IMvxNavigationService navigationService, IPokemonService pokemonService, IRestClient restClient)
 {
     _navigationService     = navigationService;
     _pokemonService        = pokemonService;
     _restClient            = restClient;
     FilterTypeCommand      = new MvxCommand(FilterPokemon);
     AllFilterTypeCommand   = new MvxCommand(AllPokemmon);
     Pokemons               = new MvxObservableCollection <PokemonGeneration>();
     PokemonSelectedCommand = new MvxAsyncCommand <PokemonGeneration>(PokemonSelected);
     FetchPokemonCommand    = new MvxCommand(
         () =>
     {
         if (!string.IsNullOrEmpty(_nextPage))
         {
             FetchPokemonTask = MvxNotifyTask.Create(LoadPokemon);
             RaisePropertyChanged(() => FetchPokemonTask);
         }
     });
     RefreshPokemonCommand = new MvxCommand(RefreshPokemon);
     _IsVisibleAllPokemon  = true;
 }
 public PokedexController(IPokemonService pokemonService, IQuizFlow quizFlow)
 {
     _pokemonService = pokemonService;
     _quizFlow       = quizFlow;
 }
Example #31
0
 public BattleService(IPokemonService pokemonService, ILogger <BattleService> logger)
 {
     _pokemonService = pokemonService;
     _logger         = logger;
 }
 public PokemonController(IPokemonService service)
 {
     _service = service;
 }
Example #33
0
        public PokemonViewModel(IStaticDataService staticDataService, IPokemonService pokemonService, INavigationService navigationService)
        {
            _tokenSource = new CancellationTokenSource();
            _staticDataService = staticDataService;
            _pokemonService = pokemonService;
            _navigationService = navigationService;

            var settings = ApplicationData.Current.LocalSettings;
            object lang = settings.Values["displayLanguage"];
            if (lang != null)
                _currentLanguage = Convert.ToInt32(lang);
            else
                _currentLanguage = 6;

            ChangeLanguage(new Language { Id = _currentLanguage });
            Messenger.Default.Register<Language>(this, (language) => ChangeLanguage(language));

            if (IsInDesignMode)
            {
                Versions = NotifyTaskCompletionCollection<GameVersion>.Create(LoadVersionsAsync(_currentLanguage));
                SpeciesList = NotifyTaskCompletionCollection<SpeciesName>.Create(LoadSpeciesAsync(null, _currentLanguage));
                Forms = NotifyTaskCompletionCollection<PokemonForm>.Create(LoadFormsAsync(new SpeciesName { Id = 1 }, null, _currentLanguage));
                CurrentForm = NotifyTaskCompletion.Create(LoadFormAsync(1, null, _currentLanguage));
                CurrentMoveSet = NotifyTaskCompletion.Create(LoadMoveSetAsync(6, null, _currentLanguage));
                CurrentStats = NotifyTaskCompletion.Create(LoadStatsAsync(6, null, _currentLanguage));
                CurrentEvolutions = NotifyTaskCompletion.Create(LoadEvolutionsAsync(6, null, _currentLanguage));
                CurrentLocations = NotifyTaskCompletion.Create(LoadLocationsAsync(6, null, _currentLanguage));
            }
        }