As part of our mortal probation, we were given a conscience, which according to LDS scripture is the "light of Christ":
And now, my brethren, seeing that ye know the light by which ye may judge, which light is the light of Christ, see that ye do not judge wrongfully; for with that same judgment which ye judge ye shall also be judged.
Wherefore, I beseech of you, brethren, that ye should search diligently in the light of Christ that ye may know good from evil; and if ye will lay hold upon every good thing, and condemn it not, ye certainly will be a child of Christ (Moroni 7:18-19).
So, this light in every person will show them what is right, and laying hold of the good things makes us children of Christ.
But then sometimes God gives commandments to His prophets that directly contradict the light of Christ. Think, for example, of the Spirit's commandment to Nephi to kill Laban, or the institution of plural marriage, when Brigham Young said he desired to be in the grave rather than take multiple wives.
It seems, then, that the ultimate test God has for us is to see if we'll go against our conscience and do what we're told anyway. But why give us a conscience in the first place if He doesn't want us to use it?