public void TestCharacterProfessions()
        {
            var client    = new WowClient(TestConstants.TestRegionName, TestConstants.Credentials, null, null);
            var character = client.GetCharacterAsync(TestConstants.TestRealmName, TestConstants.TestCharacterName,
                                                     CharacterFields.Professions).Result;

            Assert.IsNotNull(character.Professions);
            Assert.IsNull(character.Achievements);
            Assert.IsNull(character.Items);
            Assert.IsNull(character.Guild);
            Assert.IsNull(character.Progression);
            Assert.IsNull(character.Appearance);
            Assert.IsNull(character.Pvp);
            Assert.IsNull(character.Stats);

            Assert.IsNotNull(character.Professions.PrimaryProfessions);
            Assert.AreEqual(character.Professions.PrimaryProfessions.Count, 2);
            Assert.IsTrue(character.Professions.PrimaryProfessions.Any(p => p.Id == TestConstants.TestProfession1));
            Assert.IsTrue(character.Professions.PrimaryProfessions.Any(p => p.Id == TestConstants.TestProfession2));
            foreach (var profession in character.Professions.PrimaryProfessions)
            {
                Assert.IsNotNull(profession.Name);
                Assert.IsTrue(profession.Rank >= 525);
                Assert.IsTrue(profession.Maximum >= 525);
                Assert.IsNotNull(profession.Recipes);
                Assert.IsTrue(profession.Recipes.Count > 0);
                Assert.IsNotNull(profession.Icon);
                Assert.IsNotNull(profession.ToString());
            }
            Assert.IsNotNull(character.Professions.ToString());

            Assert.IsNotNull(character.Professions.SecondaryProfessions);
            Assert.AreEqual(character.Professions.SecondaryProfessions.Count, 4);

            foreach (var profession in character.Professions.SecondaryProfessions)
            {
                Assert.IsNotNull(profession.Name);
                Assert.IsTrue(profession.Rank >= 525);
                Assert.IsTrue(profession.Maximum >= 525);
                if (profession.Id == Skill.Cooking || profession.Id == Skill.FirstAid)
                {
                    Assert.IsNotNull(profession.Recipes);
                    Assert.IsTrue(profession.Recipes.Count > 0);
                }
                Assert.IsNotNull(profession.Icon);
            }

            var cp  = new CharacterProfession();
            var cps = new CharacterProfessions();
        }
Exemple #2
0
        private async Task RefreshCharacterProfessions()
        {
            CharacterProfessions.Clear();
            CharacterProfessionsName.Clear();
            var characterProfessionApiServises = new CharacterProfessionApiServises();
            var characterProfessions           = await characterProfessionApiServises.SelectCharacterProfessionsAsync();

            var sortedCharacterProfessions = from cP in characterProfessions
                                             orderby cP.Name
                                             select cP;

            foreach (var characterProfession in sortedCharacterProfessions)
            {
                CharacterProfessionsName.Add(characterProfession.Name);
                CharacterProfessions.Add(characterProfession);
            }
        }