public async Task PokemonTypeSearcher_ReturnsTypes() { #region Arrange string name = PokemonNameMother.Name(); PokemonName pokemonName = new PokemonName() { Name = name }; var pokemonTypeRepository = new Mock <PokemonTypeRepository>(); pokemonTypeRepository .Setup(r => r.Search(It.Is <PokemonName>(n => String.Equals(n.Name, name, StringComparison.InvariantCultureIgnoreCase)))) .ReturnsAsync(PokemonTypesMother.PokemonTypes()); var pokemonTypeSearcher = new PokemonTypeSearcher(pokemonTypeRepository.Object); #endregion #region Act PokemonTypes pokemonTypes = await pokemonTypeSearcher.Execute(pokemonName); #endregion #region Assert var typesArray = pokemonTypes.Types.Select(s => s.PokemonTypeName.Name).ToArray(); Assert.Equal(typesArray, PokemonTypesMother.PokemonTypes().Types.Select(s => s.PokemonTypeName.Name).ToArray(), StringComparer.InvariantCultureIgnoreCase); #endregion }
public async Task Search_Found_ReturnsTypes() { #region Arrange PokeApiPokemonTypeRepository pokemonTypeRepository = new PokeApiPokemonTypeRepository(); PokemonName pokemonName = new PokemonName() { Name = PokemonNameMother.Name() }; #endregion #region Act PokemonTypes pokemonTypes = await pokemonTypeRepository.Search(pokemonName); #endregion #region Assert var typesArray = pokemonTypes.Types.Select(s => s.PokemonTypeName.Name).ToArray(); Assert.Equal(typesArray, PokemonTypesMother.PokemonTypes().Types.Select(s => s.PokemonTypeName.Name).ToArray(), StringComparer.InvariantCultureIgnoreCase); #endregion }