Esempio n. 1
0
        public async void GetPokemon_On400Response_MustThrowException()
        {
            var pokemonService = ServiceTestsUtilities.GetMocked400PokemonService();
            var name           = "dummy";

            await Assert.ThrowsAsync <ApiCallFailedException>(() => pokemonService.GetPokemonAsync(name));
        }
Esempio n. 2
0
        public async void GetTranslation_On404Response_MustThrowException()
        {
            var shakespeareTranslationService = ServiceTestsUtilities.GetMocked404TranslationService();
            var text = "To figure on it spring season up. Her provision acuteness had excellent two why intention.";

            await Assert.ThrowsAsync <ApiCallFailedException>(() => shakespeareTranslationService.GetTranslationAsync(text));
        }
Esempio n. 3
0
        public async void GetPokemon_On200Response_MustReturnADescription()
        {
            var pokemonService   = ServiceTestsUtilities.GetMocked200PokemonService();
            var name             = "dummy";
            var pokemonDtoResult = await pokemonService.GetPokemonAsync(name);

            Assert.True(string.IsNullOrEmpty(pokemonDtoResult.Description) == false);
        }
Esempio n. 4
0
        public async void GetTranslation_On200Response_MustReturnATranslation()
        {
            var shakespeareTranslationService = ServiceTestsUtilities.GetMocked200TranslationService();
            var text = "To figure on it spring season up. Her provision acuteness had excellent two why intention.";
            var translationDtoResult = await shakespeareTranslationService.GetTranslationAsync(text);

            Assert.NotNull(translationDtoResult.Contents);
            Assert.True(string.IsNullOrEmpty(translationDtoResult.Contents.Translation) == false);
        }