public TicTacToeTest() { amir = User.NewUser("Amir"); budi = User.NewUser("Budi"); List <User> users = new List <User>(); users.Add(amir); users.Add(budi); game = GameFactory.Create("tic-tac-toe", users); }
public void InvalidPlayers() { Exception result = null; List <User> users = new List <User>(); users.Add(User.NewUser("Amir")); try { XyzGame game = GameFactory.Create("tic-tac-toe", users); } catch (Exception e) { result = e; } Assert.True(result != null); }
public void ChangeGame(Room room, XyzGame game, GameConfig config) { string query = "INSERT INTO game(id, room_id, game_type, game_config) VALUES(@id, @room_id, @game_type, @game_config)"; using (var cmd = new NpgsqlCommand(query, _connection, _transaction)) { cmd.Parameters.AddWithValue("id", game.ID); cmd.Parameters.AddWithValue("room_id", room.ID); cmd.Parameters.AddWithValue("game_type", game.Name()); cmd.Parameters.Add(new NpgsqlParameter("game_config", NpgsqlDbType.Jsonb) { Value = config }); cmd.ExecuteNonQuery(); } }