Example #1
0
        public async Task ExistsUser_ReturnsBool()
        {
            #region Arrange

            PokeApiPokemonRepository pokemonRepository = new PokeApiPokemonRepository();
            PokemonId pokemonId = new PokemonId(PokemonIdMother.Id());

            #endregion

            #region Act
            bool exists = await pokemonRepository.Exists(pokemonId);

            #endregion

            #region Assert
            Assert.True(exists);

            #endregion
        }
Example #2
0
        public async Task Search_NotFound_ReturnsNull()
        {
            #region Arrange

            PokeApiPokemonRepository pokemonRepository = new PokeApiPokemonRepository();
            PokemonId pokemonId = new PokemonId(PokemonIdMother.IdUnknown());

            #endregion

            #region Act
            Pokemon pokemon = await pokemonRepository.Find(pokemonId);

            #endregion

            #region Assert
            Assert.Null(pokemon);

            #endregion
        }
Example #3
0
        public async Task Search_Found_ReturnsPokemonDetail()
        {
            #region Arrange

            PokeApiPokemonRepository pokemonRepository = new PokeApiPokemonRepository();
            PokemonId pokemonId = new PokemonId(PokemonIdMother.Id());

            #endregion

            #region Act
            Pokemon pokemon = await pokemonRepository.Find(pokemonId);

            #endregion

            #region Assert
            var typesArray = pokemon.PokemonTypes.Types.Select(s => s.Type).ToArray();

            Assert.Equal(pokemon.PokemonId.Id, PokemonMother.Pokemon().PokemonId.Id);
            Assert.Equal(pokemon.PokemonName.Name, PokemonMother.Pokemon().PokemonName.Name);
            Assert.Equal(typesArray, PokemonMother.Pokemon().PokemonTypes.Types.Select(s => s.Type).ToArray(), StringComparer.InvariantCultureIgnoreCase);

            #endregion
        }