Beispiel #1
0
        public void UnitTest_VerifyPokemonDTO()
        {
            List <string> listTyping = new List <string>()
            {
                "Grass", "Fire", "Water"
            };
            var testDto = new PokemonDTO()
            {
                Name         = "Villager",
                PokedexEntry = 111,
                Generation   = 111,
                Types        = new List <string> {
                    "Grass"
                },
                Classification = "Village Pokemon",
                EggGroup       = "Minecraft",
                Hp             = 1,
                Attack         = 1,
                Defense        = 1,
                SpAtk          = 1,
                SpDef          = 1,
                Speed          = 1
            };

            var result = PokemonHelper.VerifyPokemonDTO(testDto, listTyping);

            Assert.Equal(true, result.Item1);

            testDto.Types = new List <string>()
            {
                "Dirt"
            };
            result = PokemonHelper.VerifyPokemonDTO(testDto, listTyping);
            Assert.NotEqual(true, result.Item1);
        }
Beispiel #2
0
        public async Task <Tuple <bool, string> > VerifyPokemonDTO(PokemonDTO pokemonDTO)
        {
            // Verify if values are correct
            var listTypes = await _typeRepository.GetTypings_List();

            return(PokemonHelper.VerifyPokemonDTO(pokemonDTO, listTypes));
        }