The Messenger of Allah (Blessings and Peace be upon him) said:
"Acquaint yourself with Allah in good times and He will know you in bad times."
If a person fears Allah and observes His commands in times of ease, he has acquainted himself with Allah. In addition, a special link or relation will develop between him and Allah. Allah will then know him during bad times, meaning that He will help him because of his obedience to Him during good times. "Acquaint yourself ", and, "He will know you", suggest a special kind of knowledge, one that points to closeness between Allah and His believing slave and to love of Allah for that slave.
Patience, when truly applied, has the effect of changing misfortune into a blessing. It is all a matter of one’s perspective and frame of mind. For Allah does not test us in order to destroy us, but rather to assess our patience and degree of faith. This is because Allah has a right to be worshipped in bad times just as He has the right to be worshipped during times of ease and well-being. Most people are faithful in their duties and responsive to commands when things are going well and in accordance to their inclinations. A crucial point to understand is that the true test is often to worship and follow commandments that are contrary to one’s liking. And in this regard people differ in their faith. How they perform in those situations will determine their ranking with Allah.