Design and test results of the AMS RICH detector