New York City is the hot spot of the COVID-19 pandemic in the United States. This paper merges information on the number of tests and the number of infections at the New York City zip code level with demographic and socioeconomic information from the decennial census and the American Community Surveys. People residing in poor or immigrant neighborhoods were less likely to be tested; but the likelihood that a test was positive was larger in those neighborhoods, as well as in neighborhoods with larger households or predominantly black populations. The rate of infection in the population depends on both the frequency of tests and on the fraction of positive tests among those tested. The non-randomness in testing across New York City neighborhoods indicates that the observed correlation between the rate of infection and the socioeconomic characteristics of a community tells an incomplete story of how the pandemic evolved in a congested urban setting.