예제 #1
0
        public void UserSendsIEnumerableOfPokemon_GetsAnIEnumerableofStrings()
        {
            //make a list/enumerable data type of pokemon 3 fake pokemon
            var PokeList = new List <Pokemon> {
                new Pokemon {
                    Name = "Diego"
                },
                new Pokemon {
                    Name = "Brandon"
                },
                new Pokemon {
                    Name = "Kaydon"
                }
            };
            //call our function with that list
            var service     = new PokeInformationService();
            var PokeStrings = service.PokemonEnumerabletoStringConverter(PokeList);
            //check to make sure that the list is only strings matching pokemon name
            var i = 0;

            foreach (var PokeString in PokeStrings)
            {
                if (!PokeString.Equals(PokeList[i].Name))
                {
                    Assert.Fail();
                }

                i++;
            }

            Assert.Pass();
        }
예제 #2
0
 public MainWindowViewModel()
 {
     _pokeService                = new PokeInformationService();
     _printingService            = new PrintingService();
     SearchPokemon               = new AwaitableDelegateCommand(SearchPokemonAsync);
     SortByTypeCommand           = new AwaitableDelegateCommand(SortByType);
     PrintSelectedPokemonCommand = new AwaitableDelegateCommand(PrintSelectedPokemon);
     _ = PrintAllPokemonAsync();
 }
예제 #3
0
        public async Task UserEntersPokemonType_GetsAllPokemonOfThatType()
        {
            string type = "flying";
            //var PokeService = new Mock<PokeInformationService>();
            var PokeService = new PokeInformationService();
            var Pokemons    = await PokeService.GetPokemonByType(type);

            foreach (var pokemon in Pokemons)
            {
                if (pokemon.PokemonTypes[0].PokemonType.Name.Equals(type) == false)
                {
                    if (pokemon.PokemonTypes[1].PokemonType.Name.Equals(type) == false)
                    {
                        Assert.Fail();
                    }
                }
            }

            Assert.Pass();
        }
예제 #4
0
        public async Task UserEntersInvalidPokemonName_IsPokemonNameValidReturnsFalse()
        {
            var InvalidNames = new List <string>()
            {
                "asdfad",
                "sdfg",
                "pikachuuu",
                "giraina",
                "asfdfdsaasdfasdf"
            };

            var service = new PokeInformationService();

            foreach (var invalidName in InvalidNames)
            {
                if (service.IsPokemonNameValid(invalidName, new List <string> {
                }))
                {
                    Assert.Fail();
                }
            }

            Assert.Pass();
        }