Пример #1
0
        public void TestArtisan()
        {
            var client     = new DiabloClient(TestConstants.TestRegion, TestConstants.Credentials, null, null);
            var blackSmith = client.GetArtisanInfoAsync(ArtisanType.Blacksmith).Result;

            Assert.IsNotNull(blackSmith);
            Assert.AreEqual(ArtisanType.Blacksmith, blackSmith.ArtisanType);
            Assert.AreEqual("Blacksmith", blackSmith.Name);
            Assert.IsNotNull(blackSmith.Portrait);
            Assert.IsNotNull(blackSmith.Training);
            Assert.IsNotNull(blackSmith.Training.Tiers);
            Assert.IsTrue(blackSmith.Training.Tiers.Count > 0);
            Assert.IsNotNull(blackSmith.Training.Tiers[0]);
            Assert.IsNotNull(blackSmith.Training.Tiers[0].Levels);
            Assert.IsTrue(blackSmith.Training.Tiers[0].Levels.Count > 0);
            Assert.IsNotNull(blackSmith.Training.Tiers[0].Levels[0]);
            Assert.IsTrue(blackSmith.Training.Tiers[0].Levels[0].Tier > 0);
            Assert.IsTrue(blackSmith.Training.Tiers[0].Levels[0].TierLevel > 0);
            Assert.IsTrue(blackSmith.Training.Tiers[0].Levels[1].ProgressPercent > 0);
            Assert.IsNotNull(blackSmith.Training.Tiers[0].Levels[0].TrainedRecipes);
            Assert.IsNotNull(blackSmith.Training.Tiers.Last().Levels.Last().TaughtRecipes);
        }
Пример #2
0
        /// <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);
        }