Example #1
0
        public async Task GetAchievementCategory_Test()
        {
            uint   id    = 81;
            string query = $"data/wow/achievement-category/{id}";
            AchievementCategoryJson result = await Api.GetAsync <AchievementCategoryJson>(query, Namespace.Static).ConfigureAwait(false);

            Assert.Equal(HttpStatusCode.OK, result.ResultCode);
            Assert.True(result.DirectlyCalled);
            Assert.Equal(id, result.Id);
        }
Example #2
0
        private async Task FillAchievementCategory(AchievementCategoryJson achievementCategoryJson)
        {
            AchievementCategoryJson result = await _blizzardApiReader.GetAsync <AchievementCategoryJson>($"data/wow/achievement-category/{achievementCategoryJson.Id}", Namespace.Static).ConfigureAwait(false);

            if (result.ResultCode != HttpStatusCode.OK)
            {
                achievementCategoryJson.ResultCode = result.ResultCode;
                result = achievementCategoryJson;
                await _dbManager.Log(new LogEvent
                {
                    Message     = "Unabled to reach BlizzardAPI",
                    Description = $"Return code {result.ResultCode}",
                    Collection  = "AchievementCategory",
                    BlizzardId  = achievementCategoryJson.Id,
                    Severity    = LogLevel.Warning
                }).ConfigureAwait(false);
            }
            await _dbManager.Insert(new AchievementCategory(result)).ConfigureAwait(false);
        }
 public void Load(AchievementCategoryJson achievementCategoryJson)
 {
     if (CheckJson(achievementCategoryJson))
     {
         BlizzardId = achievementCategoryJson.Id;
         Name       = achievementCategoryJson.Name;
         Order      = achievementCategoryJson.Order;
         if (achievementCategoryJson.ParentCategory != null)
         {
             ParentId = achievementCategoryJson.ParentCategory.Id;
         }
         if (achievementCategoryJson.Achievments != null)
         {
             foreach (AchievementJson achievment in achievementCategoryJson.Achievments)
             {
                 AchievementList.Add(achievment.Id);
             }
         }
     }
 }
 public AchievementCategory(AchievementCategoryJson achievementCategoryJson) : this()
 {
     Load(achievementCategoryJson);
 }