public void GamesTest() { var path = Path.Combine(Playnite.PlayniteTests.TempPath, "dbapigames.db"); FileSystem.DeleteFile(path); var db = new GameDatabase(); using (db.OpenDatabase(path)) { var dbApi = new DatabaseAPI(db); Assert.AreEqual(0, dbApi.GetGames().Count); db.AddGames(new List <Game>() { new Game() { Provider = Provider.Custom, Name = "Test Name 1" }, new Game() { Provider = Provider.Custom, Name = "Test Name 2" } }); Assert.AreEqual(2, dbApi.GetGames().Count); dbApi.AddGame(new Game("API Game")); Assert.AreEqual(3, dbApi.GetGames().Count); dbApi.RemoveGame(dbApi.GetGames()[0].Id); var apiGames = dbApi.GetGames(); Assert.AreEqual(2, apiGames.Count); Assert.AreEqual("API Game", apiGames[1].Name); Assert.AreEqual("Test Name 2", dbApi.GetGame(apiGames[0].Id).Name); apiGames[0].Name = "Changed Name"; dbApi.UpdateGame(apiGames[0]); Assert.AreEqual("Changed Name", dbApi.GetGame(apiGames[0].Id).Name); Assert.IsNull(dbApi.GetGame(999)); } }