In-line testing of the concentration of a chemical in a water-containing system