public void Setup()
 {
     service = new PokemonShakespeareService(
         new PokemonService(new PokemonClient()),
         new ShakespeareTranslator()
         );
 }
示例#2
0
        public void Init()
        {
            var pokemonService = new Mock <IPokemonService>();

            pokemonService.Setup(x => x.PokemonSpeciesAsync(Name)).ReturnsAsync(Species);
            pokemonService.Setup(x => x.PokemonSpeciesAsync(BadName)).Throws(new Exception(ExceptionMsg));
            pokemonService.Setup(x => x.FlavorTextAsync(Species)).ReturnsAsync(Flavor);

            var translator = new Mock <ITranslator>();

            translator.Setup(x => x.TranslateAsync(Flavor)).ReturnsAsync(Translation);

            service = new PokemonShakespeareService(pokemonService.Object, translator.Object);
        }
示例#3
0
 public PokemonController(IPokemonShakespeareService service, IMemoryCache memoryCache)
 {
     this.service     = service;
     this.memoryCache = memoryCache;
 }