protected void addButton_Click(object sender, EventArgs e) { if (!IsValid) { return; } Game game = new Game { Abbreviation = abbreviationTextBox.Text, Name = nameTextBox.Text }; using (SteamCommunityManager community = new SteamCommunityManager()) using (AchievementManager manager = new AchievementManager()) { manager.AddGame(game); IEnumerable <Achievement> achievements = community.GetAchievements(steamUserIdTextBox.Text, game); manager.AddAchievements(game.Id, achievements); } Response.Redirect("~/Admin"); }
public void AddGame() { Game newGame = new Game { Abbreviation = "NewGame", Name = "New Game" }; _manager.AddGame(newGame); Assert.That(newGame.Id, Is.GreaterThan(0)); Assert.That(_repository.Games.Count(game => game.Id == newGame.Id), Is.EqualTo(1)); }