public void PushGameInfoTest() { int[] testArray = new int[1] { 0 }; int[] testOtherArray = new int[1] { 0 }; GameInfo test = new GameInfo(); dao.PushGameInfo(999, "MechaCoder", "Enter the weapon that will change Coder Wars forever", testArray, testOtherArray, 0, 0, rtingID); using (SqlConnection connection = new SqlConnection(ConnectionString)) { connection.Open(); SqlCommand cmd = connection.CreateCommand(); cmd.CommandText = @"select * from Games where game_id = 999"; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { test.game_ID = (int)reader["game_id"]; test.franchiseID = (int)reader["franchise_id"]; test.gameDescription = (string)reader["game_description"]; test.gameName = (string)reader["game_name"]; test.genreID = reader["genre_id_array"].ToString().Split(',').Select(x => Convert.ToInt32(x)).ToArray(); test.genreID = reader["platform_id_array"].ToString().Split(',').Select(x => Convert.ToInt32(x)).ToArray(); test.ratingId = (int)reader["rating_id"]; } } Assert.AreEqual(999, test.game_ID); Assert.AreEqual(rtingID, test.ratingId); Assert.AreEqual("MechaCoder", test.gameName); }
public void PushGameInfoToSQL(IList <GameInfo> games) { //Takes the results from IGDB query and inserts any missing games into SQL DB foreach (GameInfo x in games) { gameInfoSQLDAO.PushGameInfo(x.game_ID, x.gameName, x.gameDescription, x.genreID, x.platformID, x.franchiseID, x.coverID, x.ratingId); } }