public void PokemonAPI_UnitTest() { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); PokemonDataContract pokemon = Pokemon.getInstance(1); stopWatch.Stop(); TimeSpan ts = stopWatch.Elapsed; string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}:{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds); Debug.WriteLine("RunTime: " + elapsedTime); }
public PokedexForm() { InitializeComponent(); PokemonDataContract pokemon = DataContractGenerator <PokemonDataContract> .getInstance(2); List <SpriteDataContract> sprites = pokemon.httpGetPokemonSprites(); this.pokemonSprite.Load(baseUrl + sprites.ElementAt(0).Image); this.labelPokemonName.Text = pokemon.PkdxId.ToString() + " " + pokemon.Name; this.labelSpecies.Text = pokemon.Species; this.labelType.Text = ""; List <TypeDataContract> types = pokemon.httpGetPokemonTypes(); for (int i = 0; i < types.Count; i++) { this.labelType.Text += types.ElementAt(i).Name; if (i < types.Count - 1) { this.labelType.Text += ", "; } } this.labelAbilities.Text = ""; List <AbilityDataContract> abilities = pokemon.httpGetPokemonAbilities(); for (int i = 0; i < abilities.Count; i++) { this.labelAbilities.Text += abilities.ElementAt(i).Name; if (i < abilities.Count - 1) { this.labelAbilities.Text += ", "; } } this.labelHP.Text = pokemon.Hp.ToString(); this.labelAttack.Text = pokemon.Attack.ToString(); this.labelDefence.Text = pokemon.Defense.ToString(); this.labelSpecialAttack.Text = pokemon.SpAtk.ToString(); this.labelSpecialDefence.Text = pokemon.SpDef.ToString(); this.labelSpeed.Text = pokemon.Speed.ToString(); this.labelEvYield.Text = pokemon.EvYield; this.labelGrowthRate.Text = pokemon.GrowthRate; this.labelMaleFemaleRatio.Text = pokemon.MaleFemaleRatio; List <MoveDataContract> moves = pokemon.httpGetPokemonMoves(); foreach (MoveDataContract move in moves) { ListViewItem listViewItemMove = new ListViewItem(move.LearnType); listViewItemMove.SubItems.Add(move.Level.ToString()); listViewItemMove.SubItems.Add(move.Name); listViewItemMove.SubItems.Add(move.PP.ToString()); this.listViewMoveList.Items.Add(listViewItemMove); } this.listViewMoveList_ColumnClick(null, new ColumnClickEventArgs(0)); }