The Gemara (Avoda Zarah 3a) relates that the gentile nations of the world complained about the reward that will ultimately be given to the Jewish people for observing mitzvot. Had G-d given mitzvot to them, they contended, they would also have observed them. To test the integrity of this claim, Hashem offered them one mitzvah to observe: the mitzvah of Sukkah.
So, the nations proceeded to sit in sukkot. As soon as they did so, though, Hashem made the sun shine directly on them. The heat became so unbearable that everyone simply fled from their sukkah, kicking on the way out to manifest their utter disgust.
This story gives rise to at least two questions: 1) How could the nations of the world have contended that G-d never gave them mitzvot? Is it not part of our Torah mesorah that Hashem offered them the Torah prior to the Revelation on Mount Sinai and they turned it down?
2) Usually G-d helps people observe mitzvot. In this incident, though, He made it hard for them. Why?
This incident becomes understandable when we recall that the mitzvot the nations rejected before Mattan Torah were the moral mitzvot – not to kill, not to steal, etc. What they complained about later was that they hadn’t been offered the ritual mitzvot.
Hashem understood their complaint and therefore selected the ritual mitzvah of sukkah to test them. Yet, He decided to make it hard for them to observe because the ritual and moral mitzvot are linked. Ritual mitzvot without the moral mitzvot are not acceptable to Hashem. A frum immoral person is not a religious man. A religious person contains within him a synthesis of both moral and ritual values.