public void TestGetGamesOfUser()
        {
            IEnumerable <uint> games = _sut.GetGamesOfUser(_steamId).Select(g => g.AppId).ToList();

            CollectionAssert.IsNotEmpty(games);
            Assert.AreEqual(134, games.Count());
            CollectionAssert.Contains(games, 730, "'CS GO' should be in games list");
            CollectionAssert.Contains(games, 245550, "'Free To Play' should be in games list");
            CollectionAssert.Contains(games, 221910, "'Stanley Parable' should be in games list");
        }
        public void LoadFromApi()
        {
            ulong numericValue = Convert.ToUInt64(SteamId);

            if (numericValue > 0)
            {
                BackgroundWorker bw = new BackgroundWorker();
                bw.DoWork += (sender, args) =>
                {
                    Status = "Loading user...";
                    Tuple <string, string> userInfo = _facade.GetUserInfo(numericValue);
                    Status = Status + "\r\nLoading games...";
                    List <IGame> games = _facade.GetGamesOfUser(numericValue).ToList();
                    Status = Status + string.Format("\r\n\t-> Loaded {0} games", games.Count);
                    List <IGame> gamesWithAchievements = new List <IGame>(games.Count);
                    int          i         = 0;
                    int          gameCount = games.Count;
                    foreach (IGame g in games)
                    {
                        Status = Status + string.Format("\r\nLoading achievements for '{0}' ({1})... ({2}/{3})", g.Name, g.AppId, i,
                                                        gameCount);
                        // Gets names, icons and global completion
                        try
                        {
                            g.Achievements = _facade.GetAchievements(g.AppId);
                            Status         = Status + string.Format("\r\n\t-> Found {0} achievements", g.Achievements.Count());
                            if (g.Achievements.Any())
                            {
                                gamesWithAchievements.Add(g);
                                // Sets unlock state for current user
                                Status = Status + string.Format("\r\nLoading achievement completion for '{0}' ({1})...", g.Name,
                                                                g.AppId);
                                _facade.GetAchievementCompletionStates(numericValue, g);
                            }
                        }
                        catch (Exception ex)
                        {
                            Status = Status + "\r\nERROR: Could not load achievements: " + ex.Message;
                        }
                        i++;
                    }
                    User = new User(numericValue, userInfo.Item1, userInfo.Item2)
                    {
                        OwnedGames = games
                    };
                    File.WriteAllText("E:\\data\\dev\\net\\achievement_planner_import.log", Status);
                };
                bw.RunWorkerAsync();
            }
        }