public void TestProfile() { var client = new DiabloClient(TestConstants.TestRegion, TestConstants.Credentials, null, null); var profile = client.GetProfileAsync(TestConstants.TestBattleTag).Result; Assert.IsNotNull(profile); Assert.AreEqual(TestConstants.TestBattleTag, profile.BattleTag); //Assert.IsNotNull(profile.HardcoreModeArtisans); //Assert.IsNotNull(profile.Artisans); //Assert.IsTrue(profile.Artisans.Count >= 2); //Assert.IsTrue(profile.Artisans.First(a => a.ArtisanType == ArtisanType.Blacksmith).Level >= 10); //Assert.IsTrue(profile.Artisans.First(a => a.ArtisanType == ArtisanType.Jeweler).Level >= 10); Assert.IsNotNull(profile.Progression); Assert.IsTrue(profile.Progression.Act1); Assert.IsTrue(profile.Progression.Act2); Assert.IsTrue(profile.Progression.Act3); Assert.IsTrue(profile.Progression.Act4); Assert.IsTrue(profile.Progression.Act5); Assert.IsNotNull(profile.TimePlayed); Assert.IsTrue(profile.TimePlayed.Barbarian > 0); Assert.IsTrue(profile.TimePlayed.DemonHunter > 0); Assert.IsTrue(profile.TimePlayed.Monk > 0); Assert.IsTrue(profile.TimePlayed.Witchdoctor > 0); Assert.IsTrue(profile.TimePlayed.Wizard > 0); Assert.IsNotNull(profile.Heroes); Assert.IsTrue(profile.Heroes.Count > 5); Assert.IsTrue(profile.Heroes[0].HeroClass != HeroClass.None); Assert.IsTrue(profile.Heroes[0].Level > 0); Assert.IsTrue(!string.IsNullOrWhiteSpace(profile.Heroes[0].Name)); Assert.IsTrue(profile.Heroes[0].Id > 0); }
/// <summary> /// Loads a hero then loads all items /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void Button_Click(object sender, RoutedEventArgs e) { var client = new DiabloClient(); var profile = await client.GetProfileAsync(BattleTag.Text); Characters.ItemsSource = profile.Heroes; await LoadAllHeroes(client, profile); Items.ItemsSource = profile.Heroes.Take(1).SelectMany(h => h.Items.AllItems); }
/// <summary> /// Test accessing diablo asynchronously /// </summary> /// <returns>Task</returns> private async static Task TestDiabloClientAsync() { string privateKey = ConfigurationManager.AppSettings["PrivateKey"]; string publicKey = ConfigurationManager.AppSettings["PublicKey"]; var pair = new ApiKeyPair(publicKey, privateKey); // Init client var client = new DiabloClient(Region.EU, pair, "en-gb", null); // Get profile var profile = await client.GetProfileAsync("Grendizer#2508"); // Get Hero var hero = await client.GetHeroAsync(profile.BattleTag, profile.Heroes[0].Id); /// Get item var item = await client.GetItemAsync(hero.Items.Head.TooltipParameters); // Get blacksmith info var blackSmith = await client.GetArtisanInfoAsync(ArtisanType.Blacksmith); // Get scoundrel info var scoundrel = await client.GetFollowerInfoAsync(FollowerType.Scoundrel); }
public void TestHero() { var client = new DiabloClient(TestConstants.TestRegion, TestConstants.Credentials, null, null); var profile = client.GetProfileAsync(TestConstants.TestBattleTag).Result; var hero = profile.Heroes.First(h => h.HeroClass == HeroClass.Barbarian && h.Level >= 60 && !h.IsHardcore); hero = client.GetHeroAsync(TestConstants.TestBattleTag, hero.Id).Result; Assert.IsNotNull(hero); //Assert.IsNotNull(hero.Client); Assert.IsNotNull(hero.Followers); Assert.IsNotNull(hero.Followers.Enchantress); Assert.IsNotNull(hero.Followers.Scoundrel); Assert.IsNotNull(hero.Followers.Templar); Assert.IsNotNull(hero.Followers.Templar.Items); //Assert.IsTrue(hero.Followers.Templar.Level >= 60); Assert.IsNotNull(hero.Followers.Templar.Skills); Assert.AreEqual(FollowerType.Templar, hero.Followers.Templar.FollowerType); Assert.AreEqual(FollowerType.Scoundrel, hero.Followers.Scoundrel.FollowerType); Assert.AreEqual(FollowerType.Enchantress, hero.Followers.Enchantress.FollowerType); Assert.IsTrue(hero.ParagonLevel >= 100); Assert.IsTrue(hero.Level >= 60); Assert.IsNotNull(hero.Kills); Assert.IsTrue(hero.Kills.EliteKills >= 100); Assert.IsTrue(hero.Id > 0); Assert.AreEqual(HeroGender.Male, hero.Gender); Assert.IsNotNull(hero.Stats); Assert.IsTrue(hero.Stats.ArcaneResistance > 0); Assert.IsTrue(hero.Stats.PhysicalResistance > 0); Assert.IsTrue(hero.Stats.ColdResistance > 0); Assert.IsTrue(hero.Stats.FireResistance > 0); Assert.IsTrue(hero.Stats.Intelligence > 0); Assert.IsTrue(hero.Stats.Dexterity > 0); //Assert.IsTrue(hero.Stats.MagicFind > 0); Assert.IsTrue(hero.Stats.Strength > 0); Assert.IsTrue(hero.Stats.Vitality > 0); Assert.IsTrue(hero.Stats.GoldFind > 0); Assert.IsTrue(hero.Stats.PoisonResistance > 0); Assert.IsTrue(hero.Stats.PrimaryResourceMaximum > 0); Assert.IsTrue(hero.Stats.MaximumHealthPoints > 0); Assert.IsTrue(hero.Stats.Damage > 0); //Assert.IsTrue(hero.Stats.DamageIncrease > 0); //Assert.IsTrue(hero.Stats.DamageReductionFromArmor > 0); Assert.IsTrue(hero.Stats.Armor > 0); Assert.IsTrue(hero.Stats.AttackSpeed > 0); Assert.IsTrue(hero.Stats.CriticalHitDamageBonus > 0); //Assert.IsTrue(hero.Stats.CriticalHitChance > 0); Assert.IsNotNull(hero.Items); var item = hero.Items.AllItems.FirstOrDefault(); Assert.IsNotNull(item); Assert.IsNotNull(item.Name); Assert.IsNotNull(item.Path); Assert.IsNotNull(item.TooltipParameters); Assert.IsNotNull(item.Id); Assert.IsNotNull(item.Icon); //Assert.IsNotNull(item.Client); }