The sensor is easily tested. It contains a magnetic reed switch actuated by a washer-shaped magnet on the float. Test for conductivity across the pins -- with the float in one position, the switch should be open; with the float in the other position, the switch should be closed. The weird brown stuff inside the sensor is probably rust and water, especially if (as sometimes happens) the sensor wiring has been rusting away internally.