There are two reasons your chocolate tart did not set properly: 1) the custard wasn't cooked long enough or 2) the tart didn't have long enough to chill in the fridge. For the first cause, make sure the custard is cooked until it reaches the consistency of sweetened condensed milk. For the other cause, make sure the assembled tart has at least 1 hour to set in the fridge.