public async Task TestGetByName_WithValidPokemonName_ExpectPokemonWithDescription( Mock <IPokeApiClientWrapper> pokeApiClientWrapperMock, string pokemonName, string expectedDescription) { var pokemonSpecies = PokemonSpeciesHelper.CreatePokemonSpecies(pokemonName, expectedDescription, "en"); SetupPokeApiClientWrapperMock(pokeApiClientWrapperMock, pokemonSpecies); var sutService = DIHelper.GetServices() .RegisterMock(pokeApiClientWrapperMock) .GetConfiguredService <IPokemonApiService>(); // Act var pokemon = await sutService.GetByName(pokemonName, CancellationToken.None) .ConfigureAwait(false); // Assert Assert.NotNull(pokemon); Assert.Equal(pokemonName, pokemon.Name); Assert.Equal(expectedDescription, pokemon.OriginalDescription); }
public async Task TestGetByName_WithDescriptionContainingLineBreaks_ExpectParsedDescription( Mock <IPokeApiClientWrapper> pokeApiClientWrapperMock, string pokemonName) { // Arrange const string originalDescription = "expected\ndescription\nwith some\nline breaks."; const string expectedDescription = "expected description with some line breaks."; var pokemonSpecies = PokemonSpeciesHelper.CreatePokemonSpecies(pokemonName, originalDescription, "en"); SetupPokeApiClientWrapperMock(pokeApiClientWrapperMock, pokemonSpecies); var sutService = DIHelper.GetServices() .RegisterMock(pokeApiClientWrapperMock) .GetConfiguredService <IPokemonApiService>(); // Act var pokemon = await sutService.GetByName(pokemonName, CancellationToken.None) .ConfigureAwait(false); // Assert Assert.NotNull(pokemon); Assert.Equal(pokemonName, pokemon.Name); Assert.Equal(expectedDescription, pokemon.OriginalDescription); }