public void SaveLoadGameTest() { DatabaseManager manager = new DatabaseManager(myConnection); Game gameTestData = new Game(); gameTestData.gameId = 2; gameTestData.invalid = false; gameTestData.gameMode = "Test Game Mode"; gameTestData.gameType = "Test Game Type"; gameTestData.subType = "Test Sub Type"; gameTestData.mapId = 1; gameTestData.teamId = 1; gameTestData.championId = 1; gameTestData.spell1 = 1; gameTestData.spell2 = 1; gameTestData.level = 1; gameTestData.createDate = 1; gameTestData.createDateStr = 1; manager.Save(gameTestData); Game gameLoadData = manager.Load(gameTestData.gameId); AreGamesEqual(gameTestData, gameLoadData); }
public void SaveLoadStatsTest() { DatabaseManager manager = new DatabaseManager(myConnection); Statistic[] saveStats = new Statistic[2]; Statistic stat1 = new Statistic(); stat1.name = "Test1"; stat1.value = 1; Statistic stat2 = new Statistic(); stat2.name = "Test2"; stat2.value = 2; saveStats[0] = stat1; saveStats[1] = stat2; manager.SaveStats(1, saveStats); Statistic[] loadStats = manager.LoadStats(1); foreach(Statistic stat in saveStats) { Statistic foundStat = Array.Find(loadStats, item => item.name == stat.name && item.value == stat.value); Assert.IsNotNull(foundStat); } }