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(); }
public MainWindowViewModel() { _pokeService = new PokeInformationService(); _printingService = new PrintingService(); SearchPokemon = new AwaitableDelegateCommand(SearchPokemonAsync); SortByTypeCommand = new AwaitableDelegateCommand(SortByType); PrintSelectedPokemonCommand = new AwaitableDelegateCommand(PrintSelectedPokemon); _ = PrintAllPokemonAsync(); }
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(); }
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(); }