Until Adam and Eve ate from the tree of the knowledge of good and evil, how could they know that disobeying God was sinful, as they didn't understand that it was evil? Why does God hold them accountable for sinning when they didn't know what evil was?
James 4:17 states "Anyone, then, who knows the good he ought to do and doesn't do it, sins." (NIV)
Adam and Eve knew what they should and shouldn't do. God made it very simple: "but you must not eat from the tree of the knowledge of good and evil." (Gen 2:17 NIV) It was clear that they were to avoid that tree. As James 4:17 states, they knew what to do and didn't do it and became sinners as a result.
God plainly gives Adam only one rule to live by in Genesis 2:16:
And the Lord God commanded the man, “You are free to eat from any tree in the garden; but you must not eat from the tree of the knowledge of good and evil, for when you eat from it you will certainly die.”
You can clearly see God laying down a very easygoing life for Adam with one simple stipulation: Don't eat this fruit. And Eve affirms the universal knowledge of this rule in Genesis 3:2-3.
But it goes further than that. God even says what will happen if he does eat it. Adam will die. God didn't say "I will kill you." He said "You will die [as a consequence of eating this fruit]". God created the world in such a way that the knowledge of good and evil will lead man into sin which must be paid through death (Romans 6:23). Whether the first act of disobedience was sin is semantic at this point. Adam, and even all his progeny, did willfully sin plenty afterward (Romans 3:23).
If you were told to do something by a figure of authority, you know the correct response: obey authority. If the police lights flash and you are in the car in front, you know what to do. You know that if you keep driving, you will disobey the authorities, even if you don't know exactly what the length of your punishment will be when you're caught. You instinctively know that to disobey is wrong.
So how hard was it for Adam and Eve to know right from wrong? Eve herself told the snake that she was not to eat or touch of it (Genesis 3:3). She knew that authority was to be obeyed. That was the "evil" she knew, and it was enough. But she was fooled by the tempter into seeing it differently, just like many who join gangs and do other criminal stuff ("But you'll have a family that'll take care of you if you join us." "It'll be full of thrills." "The high from this weed is like nothing you've ever had.")
She knew the act was wrong. So the tempter had to insinuate enough to get her to see the issue from a different perspective than that of law.
There is a misconception here that appears to be shared quite commonly. Adam and Eve's sin was in disobeying God's command not to eat from the tree of the knowledge of good and evil.
Since the tree contained the knowledge of both good and evil They were clueless as to what was evil, but were also clueless as to what was good. So actually it may be said that at that point is when man gained the trait of self will.
Up until they ate from the tree there would have been no consequence for disobedience since only eating from the tree was forbidden and had a God given them the consequence. I am not saying that they disobeyed God before that only that God had not ascribed any other punishment to the best of my knowledge.
Sin is, in it's most basic form, disobedience of God. Although Adam and Eve did not have the knowledge of good and evil, they did know right from wrong, as is evidenced in:
Genesis 3:2 and 3 And the woman said unto the serpent, We may eat of the fruit of the trees of the garden: But of the fruit of the tree which is in the midst of the garden, God hath said, Ye shall not eat of it, neither shall ye touch it, lest ye die.
So from this we learn that Eve and by extension Adam knew that it was right for them to eat of the fruit of the trees of the garden, but to eat of the tree of the knowledge of good and evil was wrong.
The following Scripture shows that Adam was well aware that eating from the tree was wrong, even before he had gained the knowledge of good and evil:
Genesis 3:17 And unto Adam he said, Because thou hast hearkened unto the voice of thy wife, and hast eaten of the tree, of which I commanded thee, saying, Thou shalt not eat of it: cursed is the ground for thy sake; in sorrow shalt thou eat of it all the days of thy life;
So in effect, Adam had obeyed his wife instead of obeying God.
their punishment was for disobeying his command not to eat of the tree which they both knew they were not supposed to do. In disobeying God man gained the trait of self determination, or in other words at their decision to disobey God they chose death, conversely when we chose salvation we chose life.