Basic Trope: A character is ordered to do something wrong; when he refuses, he is told he passed the test.
Straight: Jack and Tom are in a race, which is a test for becoming a warrior. Tom is injured; Jack helps him on, resulting in their being the last two to complete the race. Jack is the only racer chosen to be a warrior, because in the battle, you must rely on each other.
Exaggerated: The Grand Wizard orders Jack to kill a little girl in order to become his apprentice; Jack refuses, and the Grand Wizard accepts him as the new Grand Wizard.
Downplayed: The exact criteria for success are never explained, and/or the Secret Test appeared to have no connection to what he was doing. It's never flat-out said that his refusal to compromise his morals is what granted him victory, but it is implied.
Justified: The character trait will prove vital in whatever he is being tested for.
Jack is ordered to steal something to become a wizard; he steals it and is accepted, because an apprentice must obey his master wizard implicitly at all times.
Conversely, Jack gives the wizard a chance to harm him. Only when the wizard does not does he ask to become his apprentice.
A wizard orders Jack to kill a little girl in order to become his apprentice; Jack starts to refuse and then realizes that the little girl is a demon, so it's just a test of skill and power.
Jack is given the chance to cheat during his test. He refuses to cheat and is not given the position because he must be as opportunistic as possible.
But she's a demonic little girl, and Children Are Innocent, so he still refuses and becomes a student that way.
After the council informs Jack that they're not giving him the position because he didn't cheat, he calls them out. This causes them to give him the position because he proved just how moral he was.
Sally orders Jill to break a window to be her student, Jill decides she's too silly to be worthy studying with, and Sally instantly says she's the very paragon of perfection she's been looking for.
Alternately, everything Jill refuses to do turns out to be one of Sally's secret tests of character. "You aren't going to sleep with me? Um, good. Because no lesbian can be Warrior of the Third Light."
Zig Zagged: Tom orders Jack to kill a little girl to become his student, Jack refuses, Tom salutes him and offers him the place, Jack says it was a test to see if Tom would pull some such silly stunt to see if he was worthy of being his master, and leaves, and James appears saying he was looking for a student who could see through Tom.
Averted: No one tries to order someone to do something wrong as a test.
Enforced: "You have to show that he wasn't just chosen for his skill."
Lampshaded: "Is this the point at which I nobly throw my chance away and end up winning?"
Invoked: "I'll just leave this money here, and see if she returns it to me. Then, I'll know what she's made of."
Defied: Jack tells the tester than he doesn't want his reward; he doesn't trust him.
Conversed: "Seriously, has anyone ever won a race in real life by stopping to help everyone else?"
Once Jack learns about the test, he is disgusted that they would mess with him in such a drastic way and asks why they did something so dishonest if they were concerned about morality.