Random projections and goodness-of-fit tests in infinite-dimensional spaces