public async Task Given_EmptyOrNullPokemonName_When_GetBasicPokemonInfoAsync_IsCalled_Throws_Exception() { //Arrange var pokemonInfo = pokemonData[DataType.Valid]; mockPokeService.Setup(o => o.GetBasicPokemonInfoAsync(It.IsAny <string>())).ReturnsAsync(pokemonInfo); basicPokemonFeature = new BasicPokemonFeature(mockPokeService.Object); //Act & Assert await Assert.ThrowsAsync <ArgumentNullException>(() => basicPokemonFeature.GetBasicPokemonInfoAsync(string.Empty)); await Assert.ThrowsAsync <ArgumentNullException>(() => basicPokemonFeature.GetBasicPokemonInfoAsync(default));
public async Task Given_Valid_PokemonName_When_GetBasicPokemonInfoAsync_IsCalled_Returns_PokemonInfoDto() { //Arrange var pokemonInfo = pokemonData[DataType.Valid]; mockPokeService.Setup(o => o.GetBasicPokemonInfoAsync(It.IsAny <string>())).ReturnsAsync(pokemonInfo); basicPokemonFeature = new BasicPokemonFeature(mockPokeService.Object); //Act var result = await basicPokemonFeature.GetBasicPokemonInfoAsync("mewtwo").ConfigureAwait(false); //Assert Assert.NotNull(result); Assert.Equal("mewtwo", result.Name); Assert.Equal("rare", result.Habitat); Assert.True(result.IsLegendary); Assert.Equal("It was created by\na scientist after\nyears of horrific\fgene splicing and\nDNA engineering\nexperiments.", result.Description); }
public MyPokedexController(IBasicPokemonFeature basicPokemonFeature, ITranslatedPokemonFeature translatedPokemonFeature) { this.basicPokemonFeature = basicPokemonFeature; this.translatedPokemonFeature = translatedPokemonFeature; }